定义接收数据与集合的变量

name = input().split(" ")
collection = set()

使用for循环遍历分割空格后的字符串,利用set的特性就行去重

for i in name:
    collection.add(i)

使用sorted函数进行排序并输出

print(sorted(collection))