time limit per test1 second

memory limit per test256 megabytes

inputstandard input

outputstandard 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 from 1 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

【题解】



最大长度就是这个字符串的长度;

枚举一下最大跳跃距离就好;

100的距离

怎么样也不会超时了;

随便写吧;

#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <stack>
#include <string>
#define lson L,m,rt<<1
#define rson m+1,R,rt<<1|1
#define LL long long using namespace std; const int MAXN = 2000;
const int dx[5] = {0,1,-1,0,0};
const int dy[5] = {0,0,0,-1,1};
const double pi = acos(-1.0); string s1;
bool can[MAXN]; void input_LL(LL &r)
{
r = 0;
char t = getchar();
while (!isdigit(t) && t!='-') t = getchar();
LL sign = 1;
if (t == '-')sign = -1;
while (!isdigit(t)) t = getchar();
while (isdigit(t)) r = r * 10 + t - '0', t = getchar();
r = r*sign;
} void input_int(int &r)
{
r = 0;
char t = getchar();
while (!isdigit(t)&&t!='-') t = getchar();
int sign = 1;
if (t == '-')sign = -1;
while (!isdigit(t)) t = getchar();
while (isdigit(t)) r = r * 10 + t - '0', t = getchar();
r = r*sign;
} int main()
{
//freopen("F:\\rush.txt","r",stdin);
cin >> s1;
int len = s1.size();
for (int i = 1;i <= len;i++)
if (s1[i-1]=='A' || s1[i-1]=='E' || s1[i-1]=='I' || s1[i-1] == 'O' || s1[i-1]=='U' || s1[i-1]=='Y')
can[i] = true;
for (int i = len+1;i<= len*3;i++)
can[i] = true;
for (int k = 1;k<=len+1;k++)
{
int now = 0;
while (true)
{
bool judge = false;
for (int j = now+k;j>=now+1;j--)
if (can[j])
{
now = j;
judge = true;
break;
}
if (!judge) break;
if (now > len)
{
printf("%d\n",k);
return 0;
}
}
}
return 0;
}

最新文章

  1. Lesson 23 A new house
  2. Android笔记——eclipse快捷键
  3. libQtCassandra 0.5.0 发布
  4. jQuery核心技术-----------------------------------------------------()
  5. 面向对于javascript编程
  6. 分布式实时日志处理平台ELK
  7. Unable to open c
  8. poj 1193 内存分配
  9. JAVA通过url获取页面内容
  10. IE读取并显示本地图像文件的方法
  11. 物理提取大绝招”Advanced ADB”???
  12. cloudstack下libvirtd服务无响应问题
  13. 多线程(RunLoop)
  14. #openstack故障处理汇总
  15. Scrapy选择器的用法
  16. Ubuntu Server 18.04 网络设置不生效的解决
  17. Gradle Java Web应用程序并在Tomcat上运行
  18. 解决ssh远程连接错误问题
  19. Winform 多线程--解决界面卡死问题
  20. mysql 日期操作 增减天数、时间转换、时间戳(转换)

热门文章

  1. amazeui学习笔记--css(HTML元素3)--表单Form
  2. 关于python的二维数组
  3. 软件——机器学习与Python,输入输出的用法
  4. js进阶 13-2 jquery动画滑动效果哪些注意事项
  5. Eclipse &quot;Could not create java virtual machine&quot;的问题解决
  6. 介绍array_multisort方法
  7. DSO Framer _ WinForm 使用
  8. LA 3942 - Remember the Word 字典树+DP
  9. debian 下的vi 上下左右键问题
  10. [CSS] Use Generated Content to Augment Information