Question: Question 5: Write a program in Java to take input of a string from the user. Where every word is separated by a single blank

Question 5: Write a program in Java to take input of a string from the user. Where every word is separated by a single blank space or a comma(,). Perform the following operations on the string. a) Find and display the frequency of all the repeated words of the string. b) Find and display the longest repeating word of the string along with its frequency of repetition. SAMPLE INPUT: Welcome to India Welcome to capital of India, New Delhi, Welcome! SAMPLE OUTPUT: Word Frequency Welcome 3 to 2 India 2 The longest repeating word is Welcome with frequency 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
