题解 | #在字符串中找出连续最长的数字串#
在字符串中找出连续最长的数字串
https://www.nowcoder.com/practice/2c81f88ecd5a4cc395b5308a99afbbec
import sys re = [] for line in sys.stdin: a = line.strip() temp = '' just1 = False for i in a: if i.isdecimal(): just1 = True temp +=i elif just1 and not i.isdecimal(): just1 = False re.append(temp) temp = '' re.append(temp) resault = sorted(re,key=len) for i in resault: if len(i) == len(resault[-1]): print(i,end="") print(",",end="") print(len(resault[-1])) re = [] temp = ''