[Solved] I think I encountered a bug in the Code Coach Challenge Extra-Terrestrials for C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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.

9th Sep 2020, 6:40 PM
Tim
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
9th Sep 2020, 6:58 PM
Rohit
+ 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.
9th Sep 2020, 6:52 PM
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ - avatar
0
Thank you
9th Sep 2020, 6:58 PM
Tim