Grasshopper And the String
来源:互联网 发布:首付不够怎么买房知乎 编辑:程序博客网 时间:2024/06/05 16:33
求最大的跳跃距离
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 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
#include<stdio.h>#include<string.h>int main(){int an[30]={0};char str[105]={0};an['A'-'A']=1;an['E'-'A']=1;an['I'-'A']=1;an['O'-'A']=1;an['U'-'A']=1;an['Y'-'A']=1;while(scanf("%s",str)!=EOF){int len,pre=-1,_max=0;len=strlen(str);for(int i=0;i<len;i++){if(an[str[i]-'A']){if(i-pre>_max)_max=i-pre;pre=i;}}if(len-pre>_max)_max=len-pre;printf("%d\n",_max);}return 0;}
- Grasshopper And the String
- Grasshopper And the String
- codeforces733A.Grasshopper And the String
- A. Grasshopper And the String
- A. Grasshopper And the String
- NYOJ Grasshopper And the String
- 【codeforces】Grasshopper And the String(div2A)
- Codeforces 733A Grasshopper And the String
- codeforces--733A. Grasshopper And the String
- CodeForces 733A - Grasshopper And the String
- 733A Grasshopper And the String
- Codeforces 733A Grasshopper And the String
- 【非常高%】【codeforces 733A】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 简单模拟
- 733A Grasshopper And the String codeforces(水题)
- Release错误提示解决办法
- 终身伴侣(两个人的网站)代码+效果演示(文末源码地址)
- B
- dom4j读取xml文件获取所有标签
- 最为流行的几款Java IDE
- Grasshopper And the String
- Emergency(只有10分),保存一下代码。求大神改正。
- 1211:中文系素素的困惑
- lyx中文配置
- 微分享-高并发下的缓存实战
- 数据挖掘AdaBoost
- 用jquery获取元素的下标的值和eq的用法--案例
- Java Listener-(Java 监听器)
- 51Nod 1335 思维