Click here to Skip to main content
15,860,859 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
'We have a Paragraph in which we want to find out the word which are repeat how many time.That's give
output the word and no of time if it's come more tha one times.
Posted
Comments
Mohibur Rashid 17-Dec-11 23:56pm    
homework?
do it in home
Sergey Alexandrovich Kryukov 18-Dec-11 0:10am    
Good idea.
--SA

1 solution

Since this sounds a lot like homework, I won't give you any code.
Having said that, it isn't that difficult, just follow the steps, and test to ensure it works after each step:
1) Break your paragraph into separate words, using space and punctuation. Discard all such characters, and convert it all to lower case.
"The quick, brown fox jumps. The dog did not!"
Becomes
the
quick
brown
fox
jumps
the
dog
did
not

2) Sort your words into alphabetical order:
brown
did
dog
fox
jumps
not
quick
the
the

3) Now compare adjacent words: if they are the same, add one to the count.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900