+ 1
Can anyone help me to count the words in line. The words can be separated by '.' , ',' , ' ' , '\t' , ';' plz refer code below
10 Réponses
+ 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
+ 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.
0
Thank you for solutions but I have error with my code it gives error TLE this code runs correctly on my laptop
0
#Martin Taylor I don't want to use functions because it gives TLE
0
but I need it in c
0
how it will count words of the multiple occurrences of. ; . , \t
0
#MARTIN it's time limit exceeded error. run my program
0
I don't want to accept complete line once. I want to check each word instead checking line