-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathP2684.cpp
33 lines (26 loc) · 1.1 KB
/
P2684.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
#include <iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int T;
cin >> T;
while(T--) {
string str;
cin >> str;
int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0;
for(int i = 0; i < str.length(); i++) {
if(str[i] == 'T' && str[i + 1] == 'T' && str[i + 2] == 'T') a++;
else if(str[i] == 'T' && str[i + 1] == 'T' && str[i + 2] == 'H') b++;
else if(str[i] == 'T' && str[i + 1] == 'H' && str[i + 2] == 'T') c++;
else if(str[i] == 'T' && str[i + 1] == 'H' && str[i + 2] == 'H') d++;
else if(str[i] == 'H' && str[i + 1] == 'T' && str[i + 2] == 'T') e++;
else if(str[i] == 'H' && str[i + 1] == 'T' && str[i + 2] == 'H') f++;
else if(str[i] == 'H' && str[i + 1] == 'H' && str[i + 2] == 'T') g++;
else if(str[i] == 'H' && str[i + 1] == 'H' && str[i + 2] == 'H') h++;
}
cout << a << " " << b << " " << c << " " << d << " " << e << " " << f << " " << g << " " << h << "\n";
}
return 0;
}