-
Notifications
You must be signed in to change notification settings - Fork 0
/
00492.cpp
61 lines (47 loc) · 1.19 KB
/
00492.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <bits/stdc++.h>
using namespace std;
#define ll long long
set<char> nk({
'a', 'i', 'u', 'e', 'o'
});
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
string str;
// for(auto x: nk){
// cout << x << " ";
// } cout << "\n";
while(getline(cin, str)){
string hi = str;
for(ll i = 0; hi[i]; i++){
if(!isalpha(hi[i])) hi[i] = ' ';
}
stringstream ss(hi);
string temp;
queue<string> q;
while(ss >> temp){
if(nk.find(tolower(temp[0])) == nk.end()){
temp = temp.substr(1) + string(1, temp[0]) + "ay";
q.push(temp);
}
else{
temp += "ay";
q.push(temp);
}
}
for(ll i = 0; str[i]; i++){
if(isalpha(str[i])){
cout << q.front();
q.pop();
while(isalpha(str[i]) && str[i]) ++i;
--i;
continue;
}
cout << str[i];
}
cout << "\n";
}
return 0;
}