import sys a=sys.stdin.readline().strip() l=[] count=-1 for i in a: count+=1 if i.isdigit(): if count==0: l.append('*') l.append(i) elif a[count-1].isdigit(): l.append(i) # print(i,2,l,a[count-1]) else: l.append('*') l.append(i) # print(i,3,l,count) if i.isdigit()==0: if count==0: l.append(i) elif a[count-1].isdigit()==0: l.append(i) else: l.append('*') l.append(i) if a[-1].isdigit(): l.append('*') for i in l: print(i,end='')
标签:count,elif,else,print,华为,isdigit,机试,append,HJ96 From: https://www.cnblogs.com/tanyuanqing/p/17215874.html