I wrote a program that reverses the string that is inputted by the user, but it doesn't work. I did it using string reverse_name(name.rbegin(), name.rend()) from Reverse the string in C++, but it doesn't work and gives me the error:
no viable conversion from 'std::__cxx11::basic_string<char,
      std::char_traits<char>, std::allocator<char> >::reverse_iterator' (aka
      'reverse_iterator<__normal_iterator<char *, std::__cxx11::basic_string<char> > >') to
      'std::__cxx11::string' (aka 'basic_string<char>')
  string reversed_word = (word.rbegin(), word.rend());
My code:
#include <iostream>
using namespace std;
int main()
{
  string word, reversed_word;
  cin >> word;
  reversed_word = (word.rbegin(), word.rend());
  cout << reversed_word;
  return 0;
}
 
    