题解 | #密码截取#
密码截取
https://www.nowcoder.com/practice/3cd4621963e8454594f00199f4536bb1
def spread(left,right,word): while left>=0 and right<=len(word)-1 and word[left]==word[right]: left-=1 right+=1 return len(word[left+1:right]) while True: try: res=0 word=input() for i in range(len(word)): single=spread(i,i,word) if single>res: res=single ou=spread(i,i+1,word) if ou>res: res=ou print(res) except: break