Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string ans, s, s1; int j = 1;
- string fir(string s){
- string s1 = "";
- bool r = 0;
- if (s[0] < 'a') s[0] += 32, r = 1;
- for (int i = 0; i < s.size(); i++)
- (s[i] != 'c') ? s1 += s[i] : (i < s.size() - 1) ? (s[i + 1] == 'i' || s[i + 1] == 'e') ? s1 += 's' : (s[i + 1] != 'k') ? s1 += 'k' : s1 += "" : s1 += 'k';
- if (r) s1[0] -= 32;
- return s1;
- }
- bool li(char a) { return (a >= 'a' && a <= 'z') || (a >= 'A' && a <= 'Z');}
- string sec(string s){
- string s1 = "";
- bool r = 0;
- if (s[0] < 'a') s[0] += 32, r = 1;
- s += ' ';
- for (int i = 0; i < s.size() - 1; i++)
- (s[i] == s[i + 1]) ? i++, (s[i] == 'e' || s[i] == 'o') ? (s[i] == 'e') ? s1 += 'i' : s1 += 'u' : s1 += s[i] : s1 += s[i];
- if (r) s1[0] -= 32;
- return s1;
- }
- bool test(string s){ return ((s == "a" || s == "A") || (s == "an" || s == "An") || (s == "the" || s == "The"));}
- int main()
- {
- getline(cin, s); s += '|';
- for (int i = 0; i < s.size(); i++) {
- if (li(s[i])) s1 += s[i];
- else {
- if (test(s1)) s1 = "";
- s1 = fir(s1);
- for (int h = 0; h < 1000; h++) s1 = sec(s1);
- if (s1.size() > 1 && s1[s1.size() - 1] == 'e') s1.resize(s1.size() - 1);
- ans += s1 + s[i];
- s1 = "";
- }
- }
- ans.resize(ans.size() - 1);
- ans = '&' + ans;
- while (ans.size() && ans[ans.size() - 1] == ' ') ans.resize(ans.size() - 1);
- for (; j < ans.size() && ans[j] == ' '; j++);
- if (ans == "&") ans += ' ';
- for (int i = j; i < ans.size(); i++)
- if (!((ans[i] == ' ' && ans[i - 1] == ' '))) cout << ans[i];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement