Codeforces 733A Grasshopper And the String
来源:互联网 发布:淘宝上的红酒是真的吗 编辑:程序博客网 时间:2024/05/22 03:39
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimumjump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet.Jump ability is the maximum possible length of his jump.
Formally, consider that at the begginning the Grasshopper is located directly in front of the leftmost character of the string. His goal is to reach the position right after the rightmost character of the string. In one jump the Grasshopper could jump to the right any distance from 1 to the value of his jump ability.
The following letters are vowels: 'A', 'E', 'I', 'O', 'U' and 'Y'.
The first line contains non-empty string consisting of capital English letters. It is guaranteed that the length of the string does not exceed 100.
Print single integer a — the minimum jump ability of the Grasshopper (in the number of symbols) that is needed to overcome the given string, jumping only on vowels.
ABABBBACFEYUKOTT
4
AAA
1
这是个水题了,然而写的时候WA了好几发....
#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<algorithm>using namespace std;char store[]={'A','E','I','O','U','Y'};int main(){string str;//freopen("in.txt","r",stdin);while(cin>>str){int ans=-1;int step=0;for(int i=0;i<str.size();i++){step++;for(int j=0;j<6;j++){if(str[i]==store[j])ans=max(ans,step),step=0;}}step++;ans=max(ans,step);cout<<ans<<endl;}}
- Codeforces 733A Grasshopper And the String
- codeforces--733A. Grasshopper And the String
- CodeForces 733A - Grasshopper And the String
- Codeforces 733A Grasshopper And the String
- 【非常高%】【codeforces 733A】Grasshopper And the String
- 733A Grasshopper And the String codeforces(水题)
- CodeForces 733A Grasshopper And the String(水题)
- CodeForces 733 A.Grasshopper And the String(水~)
- 733A Grasshopper And the String
- A. Grasshopper And the String
- A. Grasshopper And the String
- Codeforces Round #378 (Div. 2)A. Grasshopper And the String
- Codeforces Round #378 (Div. 2) A. Grasshopper And the String
- codeforces#378 Div.2 A. Grasshopper And the String
- [codeforces] A. Grasshopper And the String 简单模拟
- codeforces 733A 733B之Grasshopper And the String Parade
- CodeForces 733A Grasshopper And the String(蚂蚱跳字符)
- 【codeforces】Grasshopper And the String(div2A)
- hibernate笔记
- 数据分析师,BI开发人员,数据科学家和数据工程师的角色
- 实现hadoop NN的HA自动容灾
- 51nod 1557 两个集合(hash)
- 程序员发展与晋升攻略
- Codeforces 733A Grasshopper And the String
- java静态代理
- 一个小的计算题
- matplotlib学习——设置线条颜色及形状
- Struts2笔记
- Hello Node
- 看得懂的常见排序算法分析(java实现)
- topk问题整理
- 高性能JavaScript---加载和执行