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 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

题目链接:http://codeforces.com/contest/733/problem/A

题目本意是让求他最大跳跃距离(最大跳跃距离是两个元音字母直接的距离,最后一个元音字母和结尾的距离,还有一种可能就是" B " 这样的情况)

WA了两发,

第一发没考虑到:

A 这样的数据

第二发没考虑到

B 这样的数据

AC代码:

#include<cstdio>

#include<iostream>

#include<cmath>

#include<algorithm>

#include<cstring>

using namespace std;

bool vowel( char i )

{

       if(i == 'A' || i == 'E' || i== 'I' || i== 'O' || i== 'U' || i == 'Y' || i=='\0' ||i==' ' )

              returntrue ;

       returnfalse ;

}

int main()

{

       strings;

       cin>>s;

       s='' + s ;

       int_length = s.length() ;

       intmax = 1 ;

       for(int i = 0 ; i < _length ; i++)

              {

                     if(vowel( s[i] ) )

                            {

                                   for(int j = i+1; j<=_length ; j++)

                                          {

                                                 if(vowel( s[j] ) )

                                                        {

                                                               if(j - i  > max )

                                                                      max= j-i;

                                                               break;

                                                        }

                                          }

                            }

              }

       cout<< max << endl ;

       return0 ;

}

A. Grasshopper And the String(CF ROUND 378 DIV2)的更多相关文章

  1. CF Round #580(div2)题解报告

    CF Round #580(div2)题解报告 T1 T2 水题,不管 T3 构造题,证明大约感性理解一下 我们想既然存在解 \(|a[n + i] - a[i]| = 1\) 这是必须要满足的 既然 ...

  2. CF round #622 (div2)

    CF Round 622 div2 A.简单模拟 B.数学 题意: 某人A参加一个比赛,共n人参加,有两轮,给定这两轮的名次x,y,总排名记为两轮排名和x+y,此值越小名次越前,并且对于与A同分者而言 ...

  3. [CF Round #295 div2] C. DNA Alignment 【观察与思考0.0】

    题目链接:C. DNA Alignment 题目大意就不写了,因为叙述会比较麻烦..还是直接看英文题面吧. 题目分析 经过观察与思考,可以发现,构造的串 T 的每一个字符都与给定串 S 的每一个字符匹 ...

  4. [CF Round #294 div2] E. A and B and Lecture Rooms 【树上倍增】

    题目链接:E. A and B and Lecture Rooms 题目大意 给定一颗节点数10^5的树,有10^5个询问,每次询问树上到xi, yi这两个点距离相等的点有多少个. 题目分析 若 x= ...

  5. [CF Round #294 div2] D. A and B and Interesting Substrings 【Map】

    题目链接:D. A and B and Interesting Substrings 题目大意 给定26个小写字母的权值,一共26个整数(有正有负). 给定一个小写字母组成的字符串(长度10^5),求 ...

  6. A. Alyona and Numbers(CF ROUND 358 DIV2)

    A. Alyona and Numbers time limit per test 1 second memory limit per test 256 megabytes input standar ...

  7. CF Round#436 div2

    额,这次的题目其实挺智障的.所以通过这次比赛,我也发现了自己是一个智障.... 不说太多,说多是泪... A. Fair Game 题意:给你一个数组,看你能否把它均分为两个所有元素均相同的子数组. ...

  8. CF Round #569 Div2(contest1180)

    比赛链接:http://codeforces.com/contest/1180 Problem A 题意:给出n,问方块数.看图理解... Solution: 找一找规律就可以了,发现方块数为2n*( ...

  9. CF Round #687 Div2 简要题解

    题面 A 可以发现,最远的几个人一定是 \((1, 1), (1, m), (n, 1), (n, m)\) 中的一个,直接计算即可. B 注意到颜色数量很少,直接暴力枚举最终的颜色后模拟即可. C ...

随机推荐

  1. angularJS自定义 过滤器基础

    先写个简单的例子,该过滤器是指定规定的字符串长度: html: <div ng-app="app" ng-controller="ctrl"> &l ...

  2. 【Coursera - machine learning】 Linear regression with one variable-quiz

    Question 1 Consider the problem of predicting how well a student does in her second year of college/ ...

  3. BootStrap的菜单的快速创建

    在bootstrap的3.0版本及以上时,菜单的创建有所改变. 现在,我们只需记住3个类 dropdown open dropdown-menu. 前两个是为ul 列表的父元素用的,最后一个是给ul ...

  4. SQL如何获取时间的方法?

    getdate():当前系统日期与时间 DATEADD(DAY,5,GETDATE()):当前日期的基础上加上x天 DATEDIFF(DAY,'2017-01-02','2017-01-13'):返回 ...

  5. hdu1041

    #include <iostream> #include <string> using namespace std; const int SIZE = 1001; const ...

  6. kinect1在ros-indigo环境配置

    根据周大神前车,向git下载驱动里面有详细的安装说明 $ cd $ git clone https://github.com/ZXWBOT/kinect_driver.git 按照安装说明三个包安装成 ...

  7. 【完全背包】HDU 4508 湫湫系列故事——减肥记I

    Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other) Total Submission(s) ...

  8. JAVA上连接ubuntu14.04上的Hbase

    对于新手来说,连接虚拟机上的Hbase有点繁琐,而且网上的配置不太适合初学者,今天我就整理了一下,希望对你们有帮助,第一次发博客. 1.首先去官网下载Hbase的压缩包.我这里用的是1.2.1 htt ...

  9. 端口(port)的安全模式(security mode)

    1. Cisco29系列交换机可以做基于2层的端口安全 ,即mac地址与端口进行绑定.2. Cisco3550以上交换机均可做基于2层和3层的端口安全, 即mac地址与端口绑定以及mac地址与ip地址 ...

  10. RPC 框架原理详解

    首先了解什么叫RPC,为什么要RPC,RPC是指远程过程调用?也就是说两台服务器A,B,一个应用部署在A服务器上,想要调用B服务器上应用提供的函数/方法,由于不在一个内存空间,不能直接调用,需要通过网 ...