Answer:
#Declare variable to get the input
#list from the user
input_list = input()
#split the list into words by space
list = input_list.split()
#Begin for-loop to iterate each word
#to get the word frequency
for word in list:
#get the frequency for each word
frequency=list.count(word)
#print word and frequency
print(word,frequency)
Explanation:
This program that we are told to write will be done by using python programming language/ High-level programming language.
The question wants us to write a program in which the output will be as below;
hey 1
hi 2
Mark 1
hi 2
mark 1
Just by imputing hey hi mark hi mark.
Just copy and run the code below.
#Declare variable to get the input
#list from the user
input_list = input()
#split the list into words by space
list = input_list.split()
#Begin for-loop to iterate each word
#to get the word frequency
for word in list:
#get the frequency for each word
frequency=list.count(word)
#print word and frequency
print(word,frequency)