先将a倒序输出为列表,后用冒泡排序法将a每个元素与后面对比,若有相同则删除,再将列表转换成整型。

# -*- coding: UTF-8 -*-
a=[]
n = int(input())
length = len(str(n))
for i in range(0,length ):#for 从0开始
    a.append(n%10)
    n=int(n/10)

for i in range(0,length):
    for j in range(i+1,length):
        if a[j] == a[i]:
            a[j]=[]

a = int(str(a).replace("[","").replace("]","").replace(",","").replace(" ", ""))
print(a)