s = input()
a = ''
for i in s:
if(i.isalpha()):
a = a+i
b = sorted(a, key=str.upper)
index = 0
c = ''
for i in range(len(s)):
if s[i].isalpha():
c = c + b[index]
index = index+1
else:
c = c+ s[i]
print(c)
这里使用的是先用.isalpha()判定是不是字母,然后使用sorted(a,key = str.upper)进行排序,能够实现按照字母表和输入顺序进行排序。