package leetcode;

/**
 * https://leetcode.com/problems/goat-latin/
 */
public class Problem824 {
    public String toGoatLatin(String S) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem824 prob = new Problem824();
        System.out.println(prob.toGoatLatin("I speak Goat Latin")); // "Imaa peaksmaaa oatGmaaaa atinLmaaaaa"
        System.out.println(prob.toGoatLatin("The quick brown fox jumped over the lazy dog")); //  "heTmaa uickqmaaa rownbmaaaa oxfmaaaaa umpedjmaaaaaa overmaaaaaaa hetmaaaaaaaa azylmaaaaaaaaa ogdmaaaaaaaaaa"
    }
}

@@ -145,450 +145,827 @@
     
-// TODO%0A        return null
+StringBuilder result = new StringBuilder();%0A        String%5B%5D words = S.split(%22 %22)
 ;%0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem824 prob = new Problem824();%0A        System.out.println(prob.toGoatLatin(%22I speak Goat Latin%22)); // %22Imaa peaksmaaa oatGmaaaa atinLmaaaaa%22%0A        System.out.println(prob.toGoatLatin(%22The quick brown fox jumped over the lazy dog%22)); //  %22heTmaa uickqmaaa rownbmaaaa oxfmaaaaa umpedjmaaaaaa overmaaaaaaa hetmaaaaaaaa azylmaaaaaaaaa ogdmaaaaaaaaaa%22
+for (int i = 0; i %3C words.length; i++) %7B%0A            String word = words%5Bi%5D;%0A            if (i %3E 0) %7B%0A                result.append(%22 %22);%0A            %7D%0A            if (isVowel(word.charAt(0)) %7C%7C word.length() == 1) %7B%0A                result.append(word);%0A            %7D else %7B%0A                result.append(word.substring(1)).append(word.charAt(0));%0A            %7D%0A            result.append(%22ma%22);%0A            for (int j = 0; j %3C= i; j++) %7B%0A                result.append(%22a%22);%0A            %7D%0A        %7D%0A        return result.toString();%0A    %7D%0A%0A    private static boolean isVowel(char c) %7B%0A        return c == 'a' %7C%7C c == 'i' %7C%7C c == 'u' %7C%7C c == 'e' %7C%7C c == 'o' %7C%7C%0A            c == 'A' %7C%7C c == 'I' %7C%7C c == 'U' %7C%7C c == 'E' %7C%7C c == 'O';
 %0A   

Solve problem 824