题解 | #在字符串中找出连续最长的数字串#
在字符串中找出连续最长的数字串
https://www.nowcoder.com/practice/2c81f88ecd5a4cc395b5308a99afbbec
while 1: try: s=input() l={} for i in range(len(s)): for j in range(i+1,len(s)+1): if s[i:j].isdigit(): l[s[i:j]]=len(s[i:j]) max_len=max(l.values()) #print(max_len) for i in l.items(): if i[1]==max_len: print(i[0],end='') print(',%d'%max_len) except: break