Blown Garland

题意翻译

在这个世界上没有什么是永恒的,$Kostya$ 在看到四色花环上的花死去之后明白了这个道理。 现在他有一个目标是取代所有死去的花,但他不知道每种颜色的花需要多少朵。保证每种颜色的花至少有一朵没有死。 众所周知,花环包含四种颜色的花:红、黄、蓝、绿,花环中,任意四朵连续的花不会有相同的颜色。 例如,花环可以长这样:“$\texttt{RYBGRYBGRY}$”、“$\texttt{YBGRYBGRYBG}$”、“$\texttt{BGRYB}$”。 但不能长这样:“$\texttt{BGRYG}$”、“$\texttt{YBGRYBYGR}$”、“$\texttt{BGYBGY}$”。 我们用字符表示花的颜色: ‘$\texttt{R}$’——红色 ‘$\texttt{B}$’——蓝色 ‘$\texttt{Y}$’——黄色 ‘$\texttt{G}$’——绿色。 利用题目所给的信息,求出每种花分别需要多少朵才能修补整个花环。 $1\leq |s|\leq 100$ Translated by @Ted_hjl

题目描述

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.

输入输出格式

输入格式


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.

输出格式


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.

输入输出样例

输入样例 #1

RYBGRYBGR

输出样例 #1

0 0 0 0

输入样例 #2

!RGYB

输出样例 #2

0 1 0 0

输入样例 #3

!!!!YGRB

输出样例 #3

1 1 1 1

输入样例 #4

!GB!RG!Y!

输出样例 #4

2 1 1 0

说明

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.