题解 | #在字符串中找出连续最长的数字串#
在字符串中找出连续最长的数字串
http://www.nowcoder.com/practice/2c81f88ecd5a4cc395b5308a99afbbec
import string #print(string.ascii_letters) while True: try: n_str = input() #n_str = "a8a72a6a5yy98y65ee1r2" for ele in n_str: if ele in string.ascii_letters: n_str = n_str.replace(ele," ") n_str = n_str.split(" ") except: break else: max_len = max([len(ele) for ele in n_str]) res = "" for data in n_str: if len(data) == max_len: res+=data print(res,max_len,sep=",") break