Find the no of occurrence of a word from a given string not using collections?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Find the no of occurrence of a word from a given string not using collections??

ex:: this that i am that am this output:2 this 2 that 1 i 2 am anybody know the answer?? urgent plz

8th Jul 2017, 7:49 AM
Mohan
Mohan - avatar
1 Answer
+ 1
I have forgotten the syntax but can give the algo. 1. store the string in s variable 2. 1st loop for getting each word using split by space. loop should run for half of the string length to avoid double counting 3. 2nd loop inside 1st to count the occurrences of the word. this loop
9th Jul 2017, 5:21 AM
Gurpreet Singh
Gurpreet Singh - avatar