题目链接:1333: Sequential game

Description

Sequential detector is a very important device in Hardware experiments. But is very difficult for many students such as HeroWei. In nearest days, his teacher Miss Fang let him simulate sequence detector. But there many sequence here ,and Miss Fang add the difficulty that when she give HeroWei a sequence and a string ,you must tell her how many string here in this sequence. But now Miss Fang simplified the problem for HeroWei, she just give Herowei a sequence and let HeroWei play a game with it.

When comes a character , it must compare with the rightmost one of sequence, if it’s the same with the coming characters ,the coming one just join the string. Most the right side. Otherwise all the characters in the sequence must change its value, 0 to 1 and 1 to 0,then the coming one add to its right side. Here is an example, if there is a sequence ‘110’ when comes a character 0,the sequence become ‘1100’ at last, if comes a character 1,the sequence become ‘0011’ at last.

It’s very difficult for HeroWei to play the game. Can you help him?

Input

Each line contains a composed by a string of 0s and 1s.the input is ended by EOF.

Output

For each given sequence you just play with this string as descripted above.Output a line contains two integers ,which are the number of 0s and 1s in the sequence after the game.

Sample Input

0
000
110
1111
1010
010100

Sample Output

1 0
3 0
0 4
4 0

分析

WUSTOJ 1333: Sequential game(Java)的更多相关文章

  1. WUSTOJ 1324: Base64 Coding(Java)未解决,求题解

    题目链接:1324: Base64 Coding 资料:ASCII码表 原文是英文,而且篇幅较长.因此下面不粘贴原文,只写中文大意. Description Base64是一种编码算法.它的工作原理是 ...

  2. WUSTOJ 1346: DARK SOULS(Java)并查集

    题目链接:1346: DARK SOULS 并查集系列:WUSTOJ 1319: 球(Java)并查集 Description CQ最近在玩一款游戏:DARK SOULS,这是一款以高难度闻名的硬派动 ...

  3. WUSTOJ 1246: 字符串排序(Java)

    1246: 字符串排序 题目   输入n(n<100)个字符串,每个字符串长度不超过1000,将他们按字典顺序输出.更过内容点击标题. 分析   Java中的ArrayList()可以比较方便的 ...

  4. WUSTOJ 1251: 报数游戏(Java)

    1251: 报数游戏 原题链接 Description n个人站成一行玩一个报数游戏.所有人从左到右编号为1到n.游戏开始时,最左边的人报1,他右边的人报2,编号为3的人报3,等等.当编号为n的人(即 ...

  5. WUSTOJ 1339: 土豪fcbruce(Java)

    题目链接:1339: 土豪fcbruce Description 10年后,就职于Google的fcbruce赞助了武汉科技大学好多钱,学校因此决定扩建.第一步是新建宿舍楼,为了整洁美观,fcbruc ...

  6. WUSTOJ 1323: Repeat Number(Java)规律统计

    题目链接:1323: Repeat Number Description Definition: a+b = c, if all the digits of c are same ( c is mor ...

  7. WUSTOJ 1321: Alphabet Cookies(Java)字符统计

    题目链接:1321: Alphabet Cookies Description Kitty likes cookies very much, and especially the alphabet c ...

  8. WUSTOJ 1336: Lucky Boy(Java)博弈

    题目链接:1336: Lucky Boy 参考博客:LUCKY BOY 博弈--HandsomeHow Description Recently, Lur have a good luck. He i ...

  9. WUSTOJ 1335: Similar Word(Java)

    题目链接:1335: Similar Word Description It was a crummy day for Lur. He failed to pass to the CET-6 (Col ...

随机推荐

  1. zabbix—自动发现端口并监控

    自动批量检查agent开放的端口 PS:如果服务器上的应用都是固定的,不会随机产生的都可以使用自动发现端口来监控:  如果服务器会随机出现端口且每次启动程序都会改变,可以采用第二种方法,来监控指定的端 ...

  2. 【转】利用Python将多个PDF合并为一个

    本脚本用来合并pdf文件,输出的pdf文件按输入的pdf文件名生成书签 使用示例如下: python pdfmerge.py -p "D:\pdf-files" -o " ...

  3. GLTF模型查看器---优化器【转】

    https://blog.csdn.net/weixin_43081805/article/details/88743277 Clay Viewer(我只想说好用,直接可以导出gltf的二进制glb格 ...

  4. Diamond types are not supported at language level '5‘

    当时,我问了下大神,他们问我是不是jdk问题.因为jdk8才支持这样的棱形写法.当时自己的jdk版本是jdk8,然后就奇怪了,最后我发现原来在Language level中调成了5.0 5.0不支持6 ...

  5. cache-control: max-age=1,s-maxage=1

    cache-control: max-age=1,s-maxage=1

  6. MySQL TiDB PingCAP mydumper

    MySQL备份之[mydumper 学习] - jyzhou - 博客园https://www.cnblogs.com/zhoujinyi/p/3423641.html maxbube/mydumpe ...

  7. linux内核在挂载ramdisk的过程中报错"RAMDISK: incomplete write (10739 != 32768)"如何处理?

    1. 原因 ramdisk大小不够 2. 解决方法 在启动变量bootargs中添加参数"ramdisk_size=10000000"即可

  8. 网络通信技术中的中继器repeater

    1. repeater的作用 对信号进行再生和还原 2. repeater的优点 延长通讯距离 提高可靠性 增加节点的最大数目 各个网段可以使用不同的通讯速率 3. repeater的缺点 增加了延时 ...

  9. AndoridSQLite数据库开发基础教程(9)

    AndoridSQLite数据库开发基础教程(9) 添加视图 视图是从一个或几个基本表(或视图)中导出的虚拟的表.通过视图可以看到表的内容.下面为数据库添加视图,操作步骤如下: (1)打开的数据库,单 ...

  10. TypeScript的泛型接口 泛型类接口

    /* typeScript中的泛型 泛型接口 */ //函数类型接口 /* interface ConfigFn{ (value1:string,value2:string):string; } va ...