B. Blown Garland

time limit per test:1 second
memory limit per test:256 megabytes
input:standard input
output:standard output

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 kr, kb, ky, kg — the number of dead light bulbs of red, blue, yellow and green colors accordingly.

Examples

input

RYBGRYBGR

output

0 0 0 0

input

!RGYB

output

0 1 0 0

input

!!!!YGRB

output

1 1 1 1

input

!GB!RG!Y!

output

2 1 1 0

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.

 //2017.01.19
#include <iostream>
#include <cstdio>
#include <cstring> using namespace std; int main()
{
string light;
int k[];
char l[] = {'r', 'b', 'y', 'g'};
int order[];
while(cin >> light)
{
int cnt = ;
memset(order, , sizeof(order));
memset(k, , sizeof(k));
for(int i = ; i < light.length(); i++)
{
if(light[i] != '!')
{
if(light[i] == 'R')order[i%] = ;
else if(light[i] == 'B')order[i%] = ;
else if(light[i] == 'Y')order[i%] = ;
else if(light[i] == 'G')order[i%] = ;
}
}
for(int i = ; i < light.length(); i++)
{
if(light[i] == '!')
k[order[i%]]++;
}
for(int i = ; i <= ; i++)
if(i == )cout<<k[i]<<endl;
else cout<<k[i]<<" ";
} return ;
}

Codeforces758B的更多相关文章

  1. Codeforces758B Blown Garland 2017-01-20 10:19 87人阅读 评论(0) 收藏

    B. Blown Garland time limit per test 1 second memory limit per test 256 megabytes input standard inp ...

随机推荐

  1. 浏览器加载外部js 的顺序,以及处理顺序。

    问题, 有事候按F12打开 google的调试台后,查看network下面加载过来的资源是, 有些资源的状态处于 pending.. 个人理解: 浏览器是可以同时开启多个http 请求去加载外部的资源 ...

  2. 计算机学院大学生程序设计竞赛(2015’12) 1003 The collector’s puzzle

    #include<cstdio> #include<algorithm> using namespace std; using namespace std; +; int a[ ...

  3. 在nltk中调用stanfordparser处理中文

    出现unicode decode error 解决办法是修改nltk包internals.py的java()下增加cmd的参数,cmd = ["-Dfile.encoding=UTF-8&q ...

  4. hibernate---关联关系的 crud_cascade_fetch

    CRUD怎么写?? 存user信息, 自动存group信息 user.java package com.bjsxt.hibernate; import javax.persistence.Cascad ...

  5. 在MyEclipse8.6中设置jQuery自动提示 - 肖飞figo的云计算专栏 - 博客频道 - CSDN.NET

    body{ font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI& ...

  6. Linux常用的配置文件整理

    /etc/fstab    ( 分区挂载配置文件) /etc/sysconfig/network   (主机名称配置文件) /etc/sysconfig/network-scripts/ifcfg-e ...

  7. 用命令行使用soot反编译生成jimple

    使用工具:soot-2.5.0.jar 注意:soot-2.5.0.jar必须使用Java1.7以及之前的版本,使用Java1.8会发生错误. 修改jdk的方法是在设置java_home的路径的时候, ...

  8. selenium IE 浏览器驱动下载地方

    download: http://selenium-release.storage.googleapis.com/index.html

  9. 微信小程序之----弹框组件modal

    modal modal类似于javascript中的confirm弹框,默认情况下是一个带有确认取消的弹框,不过点击取消后弹框不会自动隐藏,需要通过触发事件调用函数来控制hidden属性. 官方文档 ...

  10. C++类的存储(部分可用与c的结构体)

    c++中最重要的就是类,那么给你一个类的对象,你知道它在内存中如何存储的吗?它占内存中多少个字节? 首先确定类的构成: 1,数据成员:可以是内置类型,类类型. 2,函数成员:虚函数,非虚函数 1)数据 ...