#include <bits/stdc++.h>
using namespace std;
int n, mp[100], cnt[5];
string str;
set<string> s;
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
mp['P']=0, mp['K']=1, mp['H']=2, mp['T']=3;
cin>>str;
n=str.size();
for (int i=0; i<n; i+=3)
{
string tmp=to_string(str[i])+to_string(str[i+1])+to_string(str[i+2]);
if (s.find(tmp)!=s.end()) return cout<<"GRESKA", 0;
s.insert(tmp);
cnt[mp[str[i]]]++;
}
for (int i=0; i<4; i++) cout<<13-cnt[i]<<' ';
}
Compilation message
karte.cpp: In function 'int main()':
karte.cpp:20:22: warning: array subscript has type 'char' [-Wchar-subscripts]
20 | cnt[mp[str[i]]]++;
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
456 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |