题解 | #在字符串中找出连续最长的数字串#
在字符串中找出连续最长的数字串
https://www.nowcoder.com/practice/2c81f88ecd5a4cc395b5308a99afbbec
while True: try: a = input().strip() na = len(a) b =[] nb =0 cnt=0 cnt1=0 for c in a: if not c.isdigit(): a= a.replace(c,' ') cnt1=0 else: cnt1+=1 if cnt1 > cnt: cnt = cnt1 s= a.split() for c in s: if len(c) == cnt: b.append(c) print(''.join(b)+','+str(cnt)) except: break