#字符串a存储输入,倒序切片,遍历字符串a,判断是否在结果字符串b中,不在则添加进b,输出b a=input() b="" for i in a[::-1]: if i not in b: b+=i print(b)