题解 | #在字符串中找出连续最长的数字串#
在字符串中找出连续最长的数字串
https://www.nowcoder.com/practice/2c81f88ecd5a4cc395b5308a99afbbec?tpId=37&tqId=21315&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D13&difficulty=undefined&judgeStatus=undefined&tags=&title=92
import sys
for line in sys.stdin:
d = dict()
cnt, max_cnt = 0, 0
s = ""
for ch in line:
if ch.isdigit():
cnt += 1
s += ch
max_cnt = max(cnt, max_cnt)
else:
d[s] = cnt
cnt = 0
s = ""
for s in d:
if d[s] == max_cnt:
print(s, end="")
print("," + str(max_cnt))

