题解 | #查找兄弟单词#
查找兄弟单词
http://www.nowcoder.com/practice/03ba8aeeef73400ca7a37a5f3370fe68
list1 = list(map(str,input().split(' '))) lists = list1[1:-2] str1 = list1[-2] k = int(list1[-1]) list2 = [] for x in lists: if sorted(x) == sorted(str1) and x != str1: list2.append(x) for y in range(len(str1)): for x in range(len(list2)): n = list(list2[x]).pop() list2[x] = list2[x][:-1] list2[x] = n + list2[x] list2 = sorted(list2) print(len(list2)) if len(list2) >= k: print(list2[k-1])