Codeforces Round 392 (Div. 2)
B
Blown Garland
Codeforces
1100
原题
← AC →
翻译中…

Nothing is eternal in the world, Kostya understood it on the 7-th of January when he saw partially dead four-color garland.

翻译中…

Now he has a goal to replace dead light bulbs, however he doesn't know how many light bulbs for each color are required. It is guaranteed that for each of four colors at least one light is working.

翻译中…

It is known that the garland contains light bulbs of four colors: red, blue, yellow and green. The garland is made as follows: if you take any four consecutive light bulbs then there will not be light bulbs with the same color among them. For example, the garland can look like "RYBGRYBGRY", "YBGRYBGRYBG", "BGRYB", but can not look like "BGRYG", "YBGRYBYGR" or "BGYBGY". Letters denote colors: 'R' — red, 'B' — blue, 'Y' — yellow, 'G' — green.

翻译中…

Using the information that for each color at least one light bulb still works count the number of dead light bulbs of each four colors.

翻译中…

Input

翻译中…

The first and the only line contains the string $*s*$ ($4 ≤ |*s*| ≤ 100$), which describes the garland, the $*i*$-th symbol of which describes the color of the $*i*$-th light bulb in the order from the beginning of garland:

翻译中…
  • 'R' — the light bulb is red,
  • 'B' — the light bulb is blue,
  • 'Y' — the light bulb is yellow,
  • 'G' — the light bulb is green,
  • '!' — the light bulb is dead.
翻译中…

The string $*s*$ can not contain other symbols except those five which were described.

翻译中…

It is guaranteed that in the given string at least once there is each of four letters 'R', 'B', 'Y' and 'G'.

翻译中…

It is guaranteed that the string $*s*$ is correct garland with some blown light bulbs, it means that for example the line "GRBY!!!B" can not be in the input data.

翻译中…

Output

翻译中…

In the only line print four integers $*k*_{*r*}, *k*_{*b*}, *k*_{*y*}, *k*_{*g*}$ — the number of dead light bulbs of red, blue, yellow and green colors accordingly.

翻译中…

Note

翻译中…

In the first example there are no dead light bulbs.

翻译中…

In the second example it is obvious that one blue bulb is blown, because it could not be light bulbs of other colors on its place according to the statements.

翻译中…

样例

Input #1
RYBGRYBGR
Output #1
0 0 0 0
InputCopy OutputCopy
Input #2
!RGYB
Output #2
0 1 0 0
InputCopy OutputCopy
Input #3
!!!!YGRB
Output #3
1 1 1 1
InputCopy OutputCopy
Input #4
!GB!RG!Y!
Output #4
2 1 1 0
InputCopy OutputCopy
题目信息
题号
758B
时间限制
1 s
内存限制
256 MB
标签
暴力
模拟
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。