String (String verb) { int length = verb.length(); char c1 = toLowerCase(verb.charAt(length - 1)); if (c1 == 'e') return verb + 'd'; char c2 = toLowerCase(verb.charAt(length - 2)); if (c1 == 'y' && !isVowel(c2)) return verb.substring(0, length - 1) + "ied"; return c1 == 'c' && isVowel(c2) ? verb + "ked" : verb + "ed"; }