题解 | 表示数字
表示数字
https://www.nowcoder.com/practice/637062df51674de8ba464e792d1a0ac6
st = list(input())
s = ""
for i in range(len(st)):
if i == 0:
if st[i].isdigit():
s += "*"
s += st[i]
else:
s += st[i]
else:
if not st[i - 1].isdigit() and st[i].isdigit():
s += "*"
s += st[i]
elif st[i - 1].isdigit() and not st[i].isdigit():
s += "*"
s += st[i]
else:
s += st[i]
if i == len(st) - 1 and st[i].isdigit():
s += "*"
print(s)
查看11道真题和解析