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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值