Python题解 | #表示数字#
表示数字
https://www.nowcoder.com/practice/637062df51674de8ba464e792d1a0ac6
import sys while True: try: s = input().strip() res = '' i = 0 while i < len(s): if not s[i].isdigit(): res += s[i] else: res += '*' res += s[i] j = i + 1 while j < len(s): if s[j].isdigit(): res += s[j] j += 1 else: res += '*' i = j res += s[j] break if j == len(s): res += '*' break i += 1 print(res) except: break