集合,获得用户输入的英文语句,输出所出现的不同字母

集合,获得用户输入的英文语句,输出所出现的不同字母
集合,获得用户输入的英文语句,输出所出现的不同字母

s = input()
print(set(s))

也可转成列表: print(list(set(s)))

望采纳,谢谢!

data = input()

a = set(list(data))
a = ''.join(a)
 
print(a)

words = input("输入的英文语句:")
words_set = set(words)
print(words_set)
>>> word = input("输入:")
输入:hello world
>>> words = list(word)
>>> word_set = set(words)
>>> for word in word_set:
    if word != " ":
        count = words.count(word)
        print(word,"出现的次数:",count)    
    
# 可以 通过count 控制输出 出现次数的字母
l 出现的次数: 3
e 出现的次数: 1
h 出现的次数: 1
w 出现的次数: 1
r 出现的次数: 1
o 出现的次数: 2
d 出现的次数: 1