题解 | #在字符串中找出连续最长的数字串#
在字符串中找出连续最长的数字串
https://www.nowcoder.com/practice/2c81f88ecd5a4cc395b5308a99afbbec
# 2024年11月1日 周五 下午14:16 while True: try: s = input() for i in s: if not i.isdigit(): s = s.replace(i, " ") #print(s) ss = s.split() #print(ss) lst = [] for i in ss: lst.append(len(i)) #print(lst) m = max(lst) #print(m) lsd = [] for i in ss: if len(i) == m: lsd.append(i) #print(lsd) print("".join(map(str, lsd)) + "," + str(m)) except: break