题解 | #HJ9 提取不重复的整数#
提取不重复的整数
https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
# 方法1 # li = list(input())[::-1] # new_li = [] # for num in li: # if num not in new_li: # new_li.append(num) # print(int("".join(new_li))) # 方法2 list1 = list(input()[::-1]) list2 = list(set(list1)) list2.sort(key=lambda x: list1.index(x)) # 按照元素在list1中的索引顺序进行排序 print(int("".join(list2)))