#include bool letter (char c) { return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'); } bool vowel (char c) { return ('a' == c || 'e' == c || 'i' == c || 'o' == c || 'u' == c || 'y' == c); } void translate(char* word) { // capitalized? bool uc = 'A' <= *word && *word <= 'Z'; if (uc) *word = *word + 'a' - 'A'; // find initial consonant section int i = 0; char cs[40]; if (vowel(*word) && ! (*word == 'y')) { cs[0] = 'w'; cs[1] = 0; } else { if (*word == 'y') { cs[0] = 'y'; i = 1; } for ( ; word[i] && !vowel(word[i]); ++i) cs[i] = word[i]; cs[i]= 0; } // shift up in word for (int j = 0; j +i < 40; ++j) word[j] = word[j+i]; // fix consonant section if "sch" if (i == 3 && cs[0] == 's' &&cs[1] == 'c' && cs[2] == 'h') { cs[1] = 'k'; cs[2] = 0; } // append consonant section int k; for (k = 0; word[k]; ++k); for (int i = 0; cs[i]; ++i) word[k++] = cs[i]; // append "ay_" word[k++] = 'a'; word[k++] = 'y'; word[k++] = 0; if (uc) *word = *word - 'a' + 'A'; } main() { char word[40]; char c = cin.get(); do { if (letter(c)) { int i; for (i = 0; letter(c); ++i) { word[i] = c; c = cin.get(); } word[i] = 0; translate(word); cout << word; } cout.put(c); c = cin.get(); } while (!cin.eof()); }