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.
2 Answers
+ 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
0
Taste Yes I guess you're right as he is starting to print char from i = word.length()