+ 2

How to print the count of no of articles in the string?

My program works fine when there is no comma or fullstop. Input I am a, active person in an, world the. output 3 my output 0 How can I print 3 https://code.sololearn.com/c989sOo7mmBo/?ref=app

23rd Aug 2019, 1:33 PM
Geek
Geek - avatar
3 Respuestas
+ 6
your program splits the input in words by spaces, so b will have the value of "a," instead of "a" and so on
23rd Aug 2019, 1:53 PM
notqueued
notqueued - avatar
+ 3
Thats because the comma, fullstop, semicolon, etc. are directly connected to the article. In normal phases the " " will seperate them. So just have to delete the symbols 😊 Or replace all your if statements like this: strstr(b, "the") != NULL
23rd Aug 2019, 1:58 PM
Tom Hammerbacher
Tom Hammerbacher - avatar
+ 2
I got 2. That is strange. Wonder how. 🤔
23rd Aug 2019, 1:40 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar