#include <bits/stdc++.h>
using namespace std;
int main()
{
string S;
cin>>S;
int k = S.size()/3;
set<int> P;
set<int> K;
set<int> H;
set<int> T;
int aux;
for(int i=0; i<k; i++){
aux = 10*(int)(S[3*i+1]-'0') + (int)(S[3*i+2]-'0');
if(S[3*i]=='P'){
P.insert(aux);
}else if(S[3*i]=='K'){
K.insert(aux);
}else if(S[3*i]=='H'){
H.insert(aux);
}else{
T.insert(aux);
}
}
if((P.size()+K.size()+H.size()+T.size())< (long unsigned int) k){
cout<<"GRESKA"<<endl;
}else{
cout<<13-P.size()<<" "<<13-K.size()<<" "<<13-H.size()<<" "<<13-T.size()<<endl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
300 KB |
Output is correct |
6 |
Correct |
0 ms |
296 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |