题解 | #字符串排序#
字符串排序
https://www.nowcoder.com/practice/5190a1db6f4f4ddb92fd9c365c944584
while True: try: s = input() a = "" for i in s: if i.isalpha(): a += i b = sorted(a, key=str.upper) # 注意这个排序方法,upper后无() index = 0 d = "" for i in s: if i.isalpha(): d = d + b[index] index += 1 else: d = d + i print(d) except: break