on my codeblocks it worked fine but on codechef’s online ide it said “compilation error”,
what do i do?
You can use this
string rev = string(str.rbegin(),str.rend());
cout<<rev<<endl;
check this
You can use reverse(s.begin(), s.end());
to make the change in s
itself.
If you want it stored in a different variable you can use the method @poojitha_792 has mentioned above.