Найдите частоту каждого слова в строке в Python, используя словарь
# the frequency of the word in a sentence by using dictionary
a=input("enter the string")
b={}
c=a.split()
for i in c:
if i not in b :
b[i]=c.count(i)
else:
pass
print("frequency of the words in sentence")
for k in b:
print(k,'-',b[k])
output:
'''
enter the string Today is a great day ,
great blue sky and energetic sun makes the day better
frequency of the words in sentence
Today - 1
is - 1
a - 1
great - 2
day - 2
, - 1
blue - 1
sky - 1
and - 1
energetic - 1
sun - 1
makes - 1
the - 1
better - 1
'''
Gr@Y_orphan_ViLL@in##