How can i remove the spaces in output please provide me the proprler answer
Word Count - 2
Given a sentence S, write a program to print the frequency of each word in S, where words are sorted in alphabetical order.
Input
The input will be a single line containing a string S.
1
Expert's answer
2021-09-08T16:10:37-0400
n = input('Enter string here: ')
n_list = n.split(' ')
unique_list = sorted(set(n_list))
foriin unique_list:
print(i, n_list.count(i))
Enter string here: i am a boy am
a1
am 2
boy 1i1
Comments
Leave a comment