-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1915D.cpp
More file actions
57 lines (47 loc) · 735 Bytes
/
Copy path1915D.cpp
File metadata and controls
57 lines (47 loc) · 735 Bytes
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
#include <bits/stdc++.h>
using namespace std;
bool is_v(char ch);
bool is_c(char ch);
int main () {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
string s;
cin >> s;
string ans;
for (int i = n-1; i >= 0; i--) {
if (is_c(s[i])) {
ans += s[i];
ans += s[i-1];
ans += s[i-2];
ans += '.';
i-=2;
} else {
ans += s[i];
ans += s[i-1];
ans += '.';
i-=1;
}
}
for (int i = ans.size()-2; i >= 0; i--) {
cout << ans[i];
}
cout << endl;
}
}
bool is_v(char ch) {
if (ch == 'a' || ch == 'e') {
return true;
} else {
return false;
}
}
bool is_c(char ch) {
if (ch == 'b' || ch == 'c' || ch == 'd') {
return true;
} else {
return false;
}
}