-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path758B.cpp
42 lines (40 loc) · 836 Bytes
/
758B.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
34
35
36
37
38
39
40
41
42
#include<bits/stdc++.h>
using namespace std;
int main()
{
int r,y,g,b,R,B,Y,G;
string s;
r=b=g=y=0;
for(i=0;i<s.size();i++){
if(s[i]=='R'){
R=i;
}
if(s[i]=='B'){
B=i;
}
if(s[i]=='G'){
G=i;
}
if(s[i]=='Y'){
Y=i;
}
}
R=R%4;
B=B%4;
Y=Y%4;
G=G%4;
for(i=0;i<s.size();i++){
if(s[i]=='!'){
if(i%4==R)
r++;
else if(i%4==B)
b++;
else if(i%4==G)
g++;
else if(i%4==Y)
y++;
}
}
cout<<r<<" "<<b<<" "<<y<<" "<<g<<endl;
return 0;
}