I'm trying to reverse a string (e.g change "bro" to "orb") using iterators. Unfortunately, my code doesn't work. Here's my code:
for(std::string text; std::cin >> text;){
for(std::string::const_iterator it = text.cend() + 1; it <= text.cbegin(); --it)
std::cout << *it;
}
return 0;}
Where did I go wrong?