Whats problem to my (Extra-Terrestrial) c++ code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Whats problem to my (Extra-Terrestrial) c++ code?

The output is correct, but the coach code fail in all test cases. Whats is wrong? https://code.sololearn.com/ce4dt4cfrdrv/?ref=app

15th Jan 2020, 2:21 PM
Jean Arthur
Jean Arthur - avatar
3 Answers
+ 6
You need to avoid the null character. if(inp[i] != ' '&&inp[i] != '\0' ){ }
15th Jan 2020, 2:48 PM
Kevin ★
+ 3
for(int i = strlen(inp)-1; i>=0; i--) put like this and should be fine
15th Jan 2020, 2:45 PM
Mihai Apostol
Mihai Apostol - avatar
+ 1
Thanks for help me! 👍
16th Jan 2020, 1:52 AM
Jean Arthur
Jean Arthur - avatar