题解 | #在字符串中找出连续最长的数字串#
在字符串中找出连续最长的数字串
https://www.nowcoder.com/practice/2c81f88ecd5a4cc395b5308a99afbbec
while True:
try:
s = input()
max_l = 0
dp = [0] * (len(s) + 1)
for i in range(1, (len(s) + 1)):
if s[i - 1].isdigit():
dp[i] = dp[i - 1] + 1
max_l = max(max_l, dp[i])
else:
dp[i] = 0
for i in range(1, (len(s) + 1)):
if dp[i] == max_l:
print(s[i-max_l:i] , end='')
print(',{}'.format(max_l))
except:
break

