Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
	string str,p,command,r;
	int a,b,q,i,ii,Reverse1,Reverse2;
	while(cin>>str){
		while(cin>>q){
			for(int count = 0;count < q;count++){
				cin>>command;
				if(command = "print"){
					cin>>a>>b;
					cout<<str.substr(a,b);<<endl;
				}
				else if(str = "reverse"){
					cin>>a>>b;
					for(Reverse1 = 0,Reverse2 = str.substr(a,b).length;Reverse1 < str.substr(a,b).length,Reverse2 > 0;Reverse1++,Reverse--;){
						r[Reverse1] = str.substr(a.b)[Reverse2];
					}
					str = str.substr(0,a) + r.substr(0,str.substr(a,b).length) + str.substr(b,str.length);
				}
				else if(str = "replace"){
					cin>>a>>b>>p;
					str.substr(a,b) = p;
				}
			}
	}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:44: error: could not convert 'command.std::__cxx11::basic_string<char>::operator=(((const char*)"print"))' from 'std::__cxx11::basic_string<char>' to 'bool'
   11 |                                 if(command = "print"){
      |                                    ~~~~~~~~^~~~~~~~~
      |                                            |
      |                                            std::__cxx11::basic_string<char>
a.cc:13:63: error: expected primary-expression before '<<' token
   13 |                                         cout<<str.substr(a,b);<<endl;
      |                                                               ^~
a.cc:15:45: error: could not convert 'str.std::__cxx11::basic_string<char>::operator=(((const char*)"reverse"))' from 'std::__cxx11::basic_string<char>' to 'bool'
   15 |                                 else if(str = "reverse"){
      |                                         ~~~~^~~~~~~~~~~
      |                                             |
      |                                             std::__cxx11::basic_string<char>
a.cc:17:85: error: cannot convert 'std::__cxx11::basic_string<char>::length' from type 'std::__cxx11::basic_string<char>::size_type (std::__cxx11::basic_string<char>::)() const noexcept' {aka 'long unsigned int (std::__cxx11::basic_string<char>::)() const noexcept'} to type 'int'
   17 |                                         for(Reverse1 = 0,Reverse2 = str.substr(a,b).length;Reverse1 < str.substr(a,b).length,Reverse2 > 0;Reverse1++,Reverse--;){
      |                                                                                     ^~~~~~
a.cc:17:119: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   17 |                                         for(Reverse1 = 0,Reverse2 = str.substr(a,b).length;Reverse1 < str.substr(a,b).length,Reverse2 > 0;Reverse1++,Reverse--;){
      |                                                                                                       ~~~~~~~~~~~~~~~~^~~~~~
      |                                                                                                                             ()
a.cc:17:150: error: 'Reverse' was not declared in this scope; did you mean 'Reverse2'?
   17 |                                         for(Reverse1 = 0,Reverse2 = str.substr(a,b).length;Reverse1 < str.substr(a,b).length,Reverse2 > 0;Reverse1++,Reverse--;){
      |                                                                                                                                                      ^~~~~~~
      |                                                                                                                                                      Reverse2
a.cc:17:159: error: expected ')' before ';' token
   17 |                                         for(Reverse1 = 0,Reverse2 = str.substr(a,b).length;Reverse1 < str.substr(a,b).length,Reverse2 > 0;Reverse1++,Reverse--;){
      |                                            ~                                                                                                                  ^
      |                                                                                                                                                               )
a.cc:17:160: error: expected primary-expression before ')' token
   17 |                                         for(Reverse1 = 0,Reverse2 = str.substr(a,b).length;Reverse1 < str.substr(a,b).length,Reverse2 > 0;Reverse1++,Reverse--;){
      |                                                                                                                                                                ^
a.cc:20:92: error: invalid use of non-static member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
   20 |                                         str = str.substr(0,a) + r.substr(0,str.substr(a,b).length) + str.substr(b,str.length);
      |                                                                            ~~~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1083:7: note: declared here
 1083 |       length() const _GLIBCXX_NOEXCEPT
      |       ^~~~~~
a.cc:20:119: error: invalid use of non-static member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
   20 |                                         str = str.substr(0,a) + r.substr(0,str.substr(a,b).length) + str.substr(b,str.length);
      |                                                                                                                   ~~~~^~~~~~
/usr/include/c++/14/bits/basic_string.h:1083:7: note: declared here
 1083 |       length() const _GLIBCXX_NOEXCEPT
      |       ^~~~~~
a.cc:22:45: error: could not convert 'str.std::__cxx11::basic_string<char>::operator=(((const char*)"replace"))' from 'std::__cxx11::basic_string<char>' to 'bool'
   22 |                                 else if(str = "replace"){
      |                                         ~~~~^~~~~~~~~~~
      |                                             |
      |                                             std::__cxx11::basic_string<char>