CodeForces 733A Grasshopper And the String(水题)
2016-11-06 12:06
971 查看
A. Grasshopper And the String
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump 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 from1 to the value of his jump ability.
The
picture corresponds to the first example.
The following letters are vowels: 'A', 'E', 'I',
'O', 'U' and 'Y'.
Input
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.
Output
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.
Examples
input
output
input
output
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump 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 from1 to the value of his jump ability.
The
picture corresponds to the first example.
The following letters are vowels: 'A', 'E', 'I',
'O', 'U' and 'Y'.
Input
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.
Output
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.
Examples
input
ABABBBACFEYUKOTT
output
4
input
AAA
output
1
不认真读题的赤裸裸教训
#include<stdio.h> #include<string.h> #include<algorithm> using namespace std; int main() { char s[110]; int i,j,k,l,m,n; while(scanf("%s",s)!=EOF) { l=strlen(s); k=-1; int maxx=0; for(i=0;i<l;i++) { if(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y') { maxx=max(maxx,i-k); k=i; } } maxx=max(maxx,l-k);//注意 printf("%d\n",maxx); } return 0; }
相关文章推荐
- CodeForces 682A Alyona and Numbers (水题)
- codeforces 435A Queue on Bus Stop(模拟水题)
- codeforces 236A . Boy or Girl(字符串水题)
- 【打CF,学算法——一星级】CodeForces 318A (水题)
- codeforces 427A(水题)
- Codeforces--400A--Inna and Choose Options(模拟水题)
- CodeForces 487A(水题)
- CodeForces 703A Mishka and Game(玩骰子游戏,水题)
- CodeForces 59A Word 水题
- CodeForces 632A Grandma Laura and Apples(水题)
- Codeforces 672B Different is Good【水题】
- Mahmoud and a Triangle 【codeforces】 【水题】
- Codeforces 660A:Co-prime Array(水题+思维)
- codeforces 141A Amusing Joke(模拟水题)
- codeforces 669B B. Little Artem and Grasshopper(水题)
- Palindrome Transformation - CodeForces 486 C 水题
- CodeForces 482A-构造水题
- 【codeforces】Codeforces Round #280 (Div. 2) 水题专场
- Codeforces 84A:Toy Army(水题)
- CodeForces 492A Vanya and Cubes(水题)