1 VS 1
来源:互联网 发布:jmeter 引用java文件 编辑:程序博客网 时间:2024/05/17 01:50
Description
Alice and Bob are playing the game SanguoSha 1VS1.If Alice take a card or use a card (it may be slash,missed,peach,duel,sabotage or theft and so on) or discard (sometimes he does not need to throw any card) we will write down an uppercase 'A', if Bob does this, of course, we will write down the letter 'B'. Tell me the length of the longest operation combo performed by either player.
Input
There are several test cases, each test case contains only a string composed of uppercaser 'A' and 'B'.The input will finish with the end of file.The length of the string is no more than 1000.
Output
For each the case, output an integer indicate for the length.
Sample Input
AAABBAAAAAAABBBBAAAAAAAAAA
Sample Output
548
HINT
#include<iostream>
#include<cstring>
using namespace std;
main()
{
char a[1001];
while(scanf("%s",a)!=EOF){
string s=a;
int max=0,t=0;
for(int i=0;i<s.length();i++){
if(s[i]==s[i+1]) {t++; if(t>max) max=t;}
else t=0;
}
printf("%d\n",max+1);
}
}
我都佩服自己的智慧 2333333333
- HTTP0.9 vs. HTTP1.0 vs. HTTP1.1 vs. HTTPng
- VS (1)VS目录含义
- 1 VS 1
- Mp3Player VS Diskman(1)
- NSAssert 1 vs NSLog
- baidu vs google 1
- java vs python(1)
- vs 调试技巧 1
- vs代码调试1
- vs学习-1
- MapReduce 1 VS YARN
- [转]InnoDB vs MyISAM vs Falcon benchmarks - part 1
- [转]InnoDB vs MyISAM vs Falcon benchmarks - part 1
- [转]InnoDB vs MyISAM vs Falcon benchmarks - part 1
- 控制语句 VBA vs. R vs. Python (1) if...语句
- C++内存分配(1) - malloc vs new, delete vs free
- Thread.Sleep(0) vs Sleep(1) vs Yeild
- C#: Thread.Sleep(0) vs Sleep(1) vs Yeild
- 配置Powershell 使其支持git_for_windows 并添加到右键菜单
- Web 通信 之 长连接、长轮询(long polling)
- 理解RESTful架构
- 相似图片搜索原理四(内容特征法)
- mongoDB——通过客户端理解mongoDB体系结构
- 1 VS 1
- csu 1552: Friends(大素数判断+二分图)
- mongoDB——GridFS存储机制
- 回文数
- 用swift写一个简单的自定义modal转场动画
- JFrame简单的例子
- mongoDB——java操作mongoDB实现文件上传下载
- 对于内核中各种xxx_initcall调用的分析———linux子系统初始化
- hive 多列转单行