0

Whats wrong

doing challenge Extra-Tressials or something like that and i wrote this #include <iostream> #include <string.h> using namespace std; int main() { string word; cin >> word; int i = word.length(); while(i >= 0) { cout << word[i]; i--; } return 0; } ex. input: bathroom output: moorhtab and the test case shows that is incorrect, but my output is exactly the same as excepted output. help.

24th Feb 2020, 1:02 PM
Grzesiek Sikorski
Grzesiek Sikorski - avatar
2 Respuestas
+ 1
i'm not sure if its really matter, but your output has \0 at the very begining. but since \0 is null character it wont show up in the output, but its there
24th Feb 2020, 1:15 PM
Taste
Taste - avatar
0
Taste Yes I guess you're right as he is starting to print char from i = word.length()
24th Feb 2020, 1:28 PM
Mihai Apostol
Mihai Apostol - avatar