题解 | #合并表记录#
字符串排序
http://www.nowcoder.com/practice/5190a1db6f4f4ddb92fd9c365c944584
先将飞字母剔出去放在字典里,排序后在插入回来 a = input() dic = {} for i in range(len(a)) : if not a[i].isalpha(): dic[str(i)] = a[i] for i in a: if not i.isalpha(): a= a.replace(i,'') ls = list(a)
b= [3,4,6,9,3,1,2,0]
for i in range(1,len(ls)): for j in range(0,len(ls)-i): if ls[j].lower() > ls[j+1].lower(): ls[j],ls[j+1] = ls[j+1],ls[j] for key in dic: ls.insert(int(key),dic[key]) c = ''.join(ls) print(c)