+ 5

Why getting all test failed despite my output the same as expected output.

#include <iostream> #include <string> using namespace std; int main() { string word; getline(cin, word); for (int i = word.length(); i >= 0; i--) { cout << word[i]; } return 0; }

6th Aug 2021, 3:13 PM
Apongpoh Gilbert
Apongpoh Gilbert - avatar
4 Answers
+ 6
// To big index. It should be: for (int i = word.length()-1; i >= 0; i--) { cout << word[i]; } return 0; }
6th Aug 2021, 3:27 PM
JaScript
JaScript - avatar
+ 5
Thanks so much guys i got it now right
6th Aug 2021, 3:40 PM
Apongpoh Gilbert
Apongpoh Gilbert - avatar
+ 2
But is showing all test fail i'm confused
6th Aug 2021, 3:29 PM
Apongpoh Gilbert
Apongpoh Gilbert - avatar