n = int(input().strip()) #先处理输入 strlist = [] while n>0 : istr = input().strip() strlist.append(istr) n -= 1 #定义排序函数,返回是否交换顺序 def strOrder(a,b): la = len(a) lb = len(b) for i in range(min(la,lb)): if ord(a[i]) < ord(b[i]): return 0 # elif ord(a[i]) > ord(b[i]): return 1 else: continue if la <= lb: return 0 else: return 1 #冒泡排序 for i in range(len(strlist)-1): for j in range(i+1,len(strlist)): if strOrder(strlist[i], strlist[j]):#满足条件,则交换二者顺序 tmp = strlist[i] strlist[i] = strlist[j] strlist[j] = tmp for i in range(len(strlist)): print(strlist[i])