codeforces_733_A

Grasshopper And the String
蟋蟀和他的字符串
Grasshopper
Get 到一个新单词,蟋蟀!!
Grasshopper
Grasshopper
Grasshopper
写三遍!
重要的不是这个好像。。。
这题嘛,很简单,不过为了庆祝我python程序在Codeforces上的第一题。
题目意思就是:求2个原音字母之间的最大距离。
就是练字符串的题目。

附上我渣渣的代码:
str = input()
Vowels = ['A','E','I','O','U','Y']
length = len(str)
pos=[-1]
pos_len=0
for i in range(length):
    if str[i] in Vowels:
        pos.append(i+1)
        pos_len+=1
        if (pos_len>1):
            MinL=max(MinL,pos[pos_len]-pos[pos_len-1])
        else :
            MinL=i+1;
#print(MinL)
#print(pos)
#print(length,' ',pos[pos_len])
if (pos_len == 0):
    print(length+1)
else:
    MinL=max(MinL,length-pos[pos_len]+1)
    print(MinL)

  

原文地址:https://www.cnblogs.com/oxxxo/p/6022079.html