SHARE
TWEET

Untitled

advictoriam Jan 11th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Words
  2. {
  3.    /**
  4.       Computes a string that repeats every letter 't' in the original string.
  5.       @param s any string
  6.       @return a string with the same characters as s, except that every letter 't' is repeated
  7.    */
  8.    public String stutter(String s)
  9.    {
  10.       String newStr = "";
  11.       for(int i = 0; i < s.length(); i++)
  12.       {
  13.          if(s.charAt(i) == 't'){newStr += "tt";}
  14.          else{newStr += s.charAt(i);}
  15.       }
  16.       return newStr;
  17.    }
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top