题解 | #在字符串中找出连续最长的数字串#
在字符串中找出连续最长的数字串
http://www.nowcoder.com/practice/2c81f88ecd5a4cc395b5308a99afbbec
看到字符串使用空格替换可以节省不少步骤
while True: try: l1 = list(input()) rr = '' for i in l1: if not i.isdigit(): i = ' ' rr += i tt = '' n = 0 for i in rr.split(): if i and len(i) > n: n = len(i) tt = i elif i and len(i) == n: tt += i print(f'{tt},{n}') except EOFError: break