题解 | #字符串排序#
字符串排序
https://www.nowcoder.com/practice/5190a1db6f4f4ddb92fd9c365c944584
def solution(string): res = "" mark = [] for i,c in enumerate(string): if c.isalpha(): res += c else: mark.append(i) res = sorted(res,key=str.upper) res = list(res) for idx in mark: res.insert(idx,string[idx]) return "".join(res) while True: try: string = input() res = solution(string) print(res) except: break