-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path492.cpp
More file actions
47 lines (46 loc) · 1.12 KB
/
492.cpp
File metadata and controls
47 lines (46 loc) · 1.12 KB
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
#include <bits/stdc++.h>
char a[100000000];
char b[100000000];
void work(char b[]) {
char c[4];
int i, l;
l = strlen(b);
if (l == 1 || b[0] == 'e' || b[0] == 'E' || b[0] == 'a' || b[0] == 'A' || b[0] == 'i' || b[0] == 'I' ||
b[0] == 'o' || b[0] == 'O' || b[0] == 'u' || b[0] == 'U') {
strcat(b, "ay");
} else {
c[0] = b[0];
c[1] = '\0';
for (i = 0; i < l; i++) {
b[i] = b[i + 1];
}
strcat(c, "ay");
strcat(b, c);
}
}
int main() {
int i, j, k;
while (gets(a)) {
j = 0;
k = strlen(a);
b[0] = '\0';
for (i = 0; i <= k; i++) {
if (a[i] >= 'a' && a[i] <= 'z' || a[i] >= 'A' && a[i] <= 'Z') {
b[j] = a[i];
j++;
} else {
b[j] = '\0';
if (j != 0) {
work(b);
j = 0;
printf("%s", b);
}
if (a[i] != '\0') {
printf("%c", a[i]);
}
}
}
printf("\n");
}
return 0;
}