Can anyone help me to count the words in line. The words can be separated by '.' , ',' , ' ' , '\t' , ';' plz refer code below | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone help me to count the words in line. The words can be separated by '.' , ',' , ' ' , '\t' , ';' plz refer code below

https://code.sololearn.com/cTeo7RlB3dAj/?ref=app

26th Aug 2017, 5:05 PM
Ankush Mamidwar
Ankush Mamidwar - avatar
8 Answers
+ 2
you can use theese functions. Next use insert function to insert your words into separate strings ( array of strings) usage: direct_string = insert( place (number of letter) to insert in direct string, string you're inserting from, place you're inserting from( number of letter), number of letters to copy). I belive rest you can do on your own. https://code.sololearn.com/cip5mrE2bvMP/?ref=app
26th Aug 2017, 8:28 PM
SKELU21
SKELU21 - avatar
+ 1
It would be much much easier in python. Just make your string and next use split: string.split( '.') string.split( ',' ) string.split('\t' ) string.split ( ';' ) You have to only make loops because split function turns your string into array. You can use .size() to know how many times you must run loop. and that's it.
27th Aug 2017, 7:42 AM
SKELU21
SKELU21 - avatar
0
Thank you for solutions but I have error with my code it gives error TLE this code runs correctly on my laptop
27th Aug 2017, 3:27 AM
Ankush Mamidwar
Ankush Mamidwar - avatar
0
#Martin Taylor I don't want to use functions because it gives TLE
27th Aug 2017, 3:29 AM
Ankush Mamidwar
Ankush Mamidwar - avatar
0
but I need it in c
27th Aug 2017, 3:51 PM
Ankush Mamidwar
Ankush Mamidwar - avatar
0
how it will count words of the multiple occurrences of. ; . , \t
27th Aug 2017, 3:54 PM
Ankush Mamidwar
Ankush Mamidwar - avatar
0
#MARTIN it's time limit exceeded error. run my program
28th Aug 2017, 3:12 PM
Ankush Mamidwar
Ankush Mamidwar - avatar
0
I don't want to accept complete line once. I want to check each word instead checking line
28th Aug 2017, 3:14 PM
Ankush Mamidwar
Ankush Mamidwar - avatar