0
[Solved] I think I encountered a bug in the Code Coach Challenge Extra-Terrestrials for C++
In the code below: https://code.sololearn.com/c7LoI6W2CdYy/?ref=app the Output of my code matches exact the output which is wanted, at least in the first two cases but they were all declared false. I don't see why this happens and would be happy if someone can explain me why my output is wrong.
3 Answers
+ 4
Tim you've got a space right in front of your output.
(Make i = 1 inside for loop and it's work like charm)
before reverse:
"tim\0" => tim(space)
after reverse:
"\0mit" => (space)mit <--- error here
+ 2
Tim
The error line ,
int n=s.length()-1,i;
your code gives '\0' after the ending of the output(wort[] array).
'\0' is the last element of the array.
0
Thank you