criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(void){
	string str, ope, p, str_rev;
	int q, a, b;
	cin >>str >>q;
	for(int i=0; i<q; i++){
		cin >>ope >>a >>b;
		if(ope=="replace"){
			cin >>p;
			str.replace(a, p.size(), p);
		}else if(ope=="reverse"){
			str_rev=str.substr(a, b-a+1);
			reverse(str_rev.begin(), str_rev.end());
			str.replace(a, str_rev.size(), str_rev);
		}else{
			cout <<str.substr(a, b) <<endl;
		}
	}
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: 'reverse' was not declared in this scope
   16 |                         reverse(str_rev.begin(), str_rev.end());
      |                         ^~~~~~~
Language: C++

//
// Created by tac on 2016/10/16.
//

#include <cstdlib>
#include <string>
#include <iostream>

namespace {

void print(const std::string &str,
           std::string::size_type a,
           std::string::size_type b) {
    std::cout << str.substr(a, b - a + 1) << std::endl;
    return;
}

const std::string reverse(const std::string &str,
                          std::string::size_type a,
                          std::string::size_type b) {
    std::string ret = str;
    std::reverse(ret.begin() + a, ret.begin() + (b + 1));
    return ret;
}

const std::string replace(const std::string &str,
                          std::string::size_type a,
                          std::string::size_type b,
                          const std::string &rep) {
    std::string ret = str;
    ret.replace(ret.begin() + a, ret.begin() + (b - a + 1), rep);
    return ret;
}

}

int main() {
    std::string str;
    int n;
    std::string op, rep;
    int a, b;
    std::cin >> str;
    std::cin >> n;
    for (int i = 0; i < n; ++i) {
        std::cin >> op;
        std::cin >> a >> b;
        if (op == "print") {
            print(str, a, b);
        } else if (op == "reverse") {
            str = reverse(str, a, b);
        } else if (op == "replace") {
            std::cin >> rep;
            str = replace(str, a, b, rep);
        } else {
            throw std::runtime_error("");
        }
    }
    return EXIT_SUCCESS;
}

Compiler output:
a.cc: In function 'const std::string {anonymous}::reverse(const std::string&, std::__cxx11::basic_string<char>::size_type, std::__cxx11::basic_string<char>::size_type)':
a.cc:22:10: error: 'reverse' is not a member of 'std'; did you mean '{anonymous}::reverse'?
   22 |     std::reverse(ret.begin() + a, ret.begin() + (b + 1));
      |          ^~~~~~~
a.cc:18:19: note: '{anonymous}::reverse' declared here
   18 | const std::string reverse(const std::string &str,
      |                   ^~~~~~~
Language: C++

//
// Created by tac on 2016/10/16.
//

#include <cstdlib>
#include <string>
#include <iostream>

namespace {

void print(const std::string &str,
           std::string::size_type a,
           std::string::size_type b) {
    std::cout << str.substr(a, b - a + 1) << std::endl;
    return;
}

const std::string reverse(const std::string &str,
                          std::string::size_type a,
                          std::string::size_type b) {
    std::string ret = str;
    std::reverse(ret.begin() + a, ret.begin() + b + 1);
    return ret;
}

const std::string replace(const std::string &str,
                          std::string::size_type a,
                          std::string::size_type b,
                          const std::string &rep) {
    std::string ret = str;
    ret.replace(ret.begin() + a, ret.begin() + (b - a + 1), rep);
    return ret;
}

}

int main() {
    std::string str;
    int n;
    std::string op, rep;
    int a, b;
    std::cin >> str;
    std::cin >> n;
    for (int i = 0; i < n; ++i) {
        std::cin >> op;
        std::cin >> a >> b;
        if (op == "print") {
            print(str, a, b);
        } else if (op == "reverse") {
            str = reverse(str, a, b);
        } else if (op == "replace") {
            std::cin >> rep;
            str = replace(str, a, b, rep);
        } else {
            throw std::runtime_error("");
        }
    }
    return EXIT_SUCCESS;
}

Compiler output:
a.cc: In function 'const std::string {anonymous}::reverse(const std::string&, std::__cxx11::basic_string<char>::size_type, std::__cxx11::basic_string<char>::size_type)':
a.cc:22:10: error: 'reverse' is not a member of 'std'; did you mean '{anonymous}::reverse'?
   22 |     std::reverse(ret.begin() + a, ret.begin() + b + 1);
      |          ^~~~~~~
a.cc:18:19: note: '{anonymous}::reverse' declared here
   18 | const std::string reverse(const std::string &str,
      |                   ^~~~~~~
Language: C++

//
// Created by tac on 2016/10/16.
//

#include <cstdlib>
#include <string>
#include <iostream>

namespace {

void print(const std::string &str,
           std::string::size_type a,
           std::string::size_type b) {
    std::cout << str.substr(a, b - a + 1) << std::endl;
    return;
}

const std::string reverse(const std::string &str,
                          std::string::size_type a,
                          std::string::size_type b) {
    std::string ret = str;
    std::reverse(ret.begin() + a, ret.begin() + b + 1);
    return ret;
}

const std::string replace(const std::string &str,
                          std::string::size_type a,
                          std::string::size_type b,
                          const std::string &rep) {
    std::string ret = str;
    ret.replace(ret.begin() + a, ret.begin() + (b + 1), rep);
    return ret;
}

}

int main() {
    std::string str;
    int n;
    std::string op, rep;
    int a, b;
    std::cin >> str;
    std::cin >> n;
    for (int i = 0; i < n; ++i) {
        std::cin >> op;
        std::cin >> a >> b;
        if (op == "print") {
            print(str, a, b);
        } else if (op == "reverse") {
            str = reverse(str, a, b);
        } else if (op == "replace") {
            std::cin >> rep;
            str = replace(str, a, b, rep);
        } else {
            throw std::runtime_error("");
        }
    }
    return EXIT_SUCCESS;
}

Compiler output:
a.cc: In function 'const std::string {anonymous}::reverse(const std::string&, std::__cxx11::basic_string<char>::size_type, std::__cxx11::basic_string<char>::size_type)':
a.cc:22:10: error: 'reverse' is not a member of 'std'; did you mean '{anonymous}::reverse'?
   22 |     std::reverse(ret.begin() + a, ret.begin() + b + 1);
      |          ^~~~~~~
a.cc:18:19: note: '{anonymous}::reverse' declared here
   18 | const std::string reverse(const std::string &str,
      |                   ^~~~~~~
Language: C++

#include<iostream>
#inlcude<string>
using namespace std;

int main(){
     string str,order;
     int a,b,q;
     cin>>str;
     cin>>q;
     cin>>order>>a>>b;

     for(int i=0;i<q;i++){
          if(order==print) print(a,b,str);
          else if(order==reverse) str=reverse(a,b,str);
          else if(order==replase) str=replace(a,b,str);
     }
}

void print(int a,int b,str){
     cout<<str.substr(a,a+b-1)<<endl;
}

string reverse(int a,int b,string str){
     string rev=str.substr(a,a+b-1);
     rev=reverse(rev.begin(),rev.end());
     str=str.replace(a,b-a+1,rev)
     return str;
}

string replace(int a,int b,int c,string str){
     stirng rep;
     cin>>rep;
     str=str.replace(a,a+b-1,rep);
     return str;
}
     
     

Compiler output:
a.cc:2:2: error: invalid preprocessing directive #inlcude; did you mean #include?
    2 | #inlcude<string>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:13:21: error: 'print' was not declared in this scope; did you mean 'printf'?
   13 |           if(order==print) print(a,b,str);
      |                     ^~~~~
      |                     printf
a.cc:14:26: error: 'reverse' was not declared in this scope
   14 |           else if(order==reverse) str=reverse(a,b,str);
      |                          ^~~~~~~
a.cc:15:26: error: 'replase' was not declared in this scope
   15 |           else if(order==replase) str=replace(a,b,str);
      |                          ^~~~~~~
a.cc:15:39: error: 'replace' was not declared in this scope
   15 |           else if(order==replase) str=replace(a,b,str);
      |                                       ^~~~~~~
a.cc: At global scope:
a.cc:19:24: error: 'str' has not been declared
   19 | void print(int a,int b,str){
      |                        ^~~
a.cc: In function 'void print(int, int, int)':
a.cc:20:12: error: 'str' was not declared in this scope; did you mean 'std'?
   20 |      cout<<str.substr(a,a+b-1)<<endl;
      |            ^~~
      |            std
a.cc: In function 'std::string reverse(int, int, std::string)':
a.cc:25:27: error: cannot convert 'std::__cxx11::basic_string<char>::iterator' to 'int'
   25 |      rev=reverse(rev.begin(),rev.end());
      |                  ~~~~~~~~~^~
      |                           |
      |                           std::__cxx11::basic_string<char>::iterator
a.cc:23:20: note:   initializing argument 1 of 'std::string reverse(int, int, std::string)'
   23 | string reverse(int a,int b,string str){
      |                ~~~~^
a.cc:26:34: error: expected ';' before 'return'
   26 |      str=str.replace(a,b-a+1,rev)
      |                                  ^
      |                                  ;
   27 |      return str;
      |      ~~~~~~                       
a.cc:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
   28 | }
      | ^
a.cc: In function 'std::string replace(int, int, int, std::string)':
a.cc:31:6: error: 'stirng' was not declared in this scope
   31 |      stirng rep;
      |      ^~~~~~
a.cc:32:11: error: 'rep' was not declared in this scope
   32 |      cin>>rep;
      |           ^~~
Language: C++

#include<iostream>
#include<string>
using namespace std;

int main(){
     string str,order;
     int a,b,q;
     cin>>str;
     cin>>q;
     cin>>order>>a>>b;

     for(int i=0;i<q;i++){
          if(order==print) print(a,b,str);
          else if(order==reverse) str=reverse(a,b,str);
          else if(order==replase) str=replace(a,b,str);
     }
}

void print(int a,int b,str){
     cout<<str.substr(a,a+b-1)<<endl;
}

string reverse(int a,int b,string str){
     string rev=str.substr(a,a+b-1);
     rev=reverse(rev.begin(),rev.end());
     str=str.replace(a,b-a+1,rev)
     return str;
}

string replace(int a,int b,int c,string str){
     stirng rep;
     cin>>rep;
     str=str.replace(a,a+b-1,rep);
     return str;
}
     
     

Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: 'print' was not declared in this scope; did you mean 'printf'?
   13 |           if(order==print) print(a,b,str);
      |                     ^~~~~
      |                     printf
a.cc:14:26: error: 'reverse' was not declared in this scope
   14 |           else if(order==reverse) str=reverse(a,b,str);
      |                          ^~~~~~~
a.cc:15:26: error: 'replase' was not declared in this scope
   15 |           else if(order==replase) str=replace(a,b,str);
      |                          ^~~~~~~
a.cc:15:39: error: 'replace' was not declared in this scope
   15 |           else if(order==replase) str=replace(a,b,str);
      |                                       ^~~~~~~
a.cc: At global scope:
a.cc:19:24: error: 'str' has not been declared
   19 | void print(int a,int b,str){
      |                        ^~~
a.cc: In function 'void print(int, int, int)':
a.cc:20:12: error: 'str' was not declared in this scope; did you mean 'std'?
   20 |      cout<<str.substr(a,a+b-1)<<endl;
      |            ^~~
      |            std
a.cc: In function 'std::string reverse(int, int, std::string)':
a.cc:25:27: error: cannot convert 'std::__cxx11::basic_string<char>::iterator' to 'int'
   25 |      rev=reverse(rev.begin(),rev.end());
      |                  ~~~~~~~~~^~
      |                           |
      |                           std::__cxx11::basic_string<char>::iterator
a.cc:23:20: note:   initializing argument 1 of 'std::string reverse(int, int, std::string)'
   23 | string reverse(int a,int b,string str){
      |                ~~~~^
a.cc:26:34: error: expected ';' before 'return'
   26 |      str=str.replace(a,b-a+1,rev)
      |                                  ^
      |                                  ;
   27 |      return str;
      |      ~~~~~~                       
a.cc:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
   28 | }
      | ^
a.cc: In function 'std::string replace(int, int, int, std::string)':
a.cc:31:6: error: 'stirng' was not declared in this scope
   31 |      stirng rep;
      |      ^~~~~~
a.cc:32:11: error: 'rep' was not declared in this scope
   32 |      cin>>rep;
      |           ^~~
Language: C++

#include<iostream>
#include<string>
using namespace std;

int main(){
     string str,order;
     int a,b,q;
     cin>>str;
     cin>>q;
     cin>>order>>a>>b;

     for(int i=0;i<q;i++){
          if(order=="print") print(a,b,str);
          else if(order=="reverse") str=reverse(a,b,str);
          else if(order=="replase") str=replace(a,b,str);
     }
}

void print(int a,int b,str){
     cout<<str.substr(a,a+b-1)<<endl;
}

string reverse(int a,int b,string str){
     string rev=str.substr(a,a+b-1);
     rev=reverse(rev.begin(),rev.end());
     str=str.replace(a,b-a+1,rev)
     return str;
}

string replace(int a,int b,int c,string str){
     stirng rep;
     cin>>rep;
     str=str.replace(a,a+b-1,rep);
     return str;
}
     
     

Compiler output:
a.cc: In function 'int main()':
a.cc:13:30: error: 'print' was not declared in this scope; did you mean 'printf'?
   13 |           if(order=="print") print(a,b,str);
      |                              ^~~~~
      |                              printf
a.cc:14:41: error: 'reverse' was not declared in this scope
   14 |           else if(order=="reverse") str=reverse(a,b,str);
      |                                         ^~~~~~~
a.cc:15:41: error: 'replace' was not declared in this scope
   15 |           else if(order=="replase") str=replace(a,b,str);
      |                                         ^~~~~~~
a.cc: At global scope:
a.cc:19:24: error: 'str' has not been declared
   19 | void print(int a,int b,str){
      |                        ^~~
a.cc: In function 'void print(int, int, int)':
a.cc:20:12: error: 'str' was not declared in this scope; did you mean 'std'?
   20 |      cout<<str.substr(a,a+b-1)<<endl;
      |            ^~~
      |            std
a.cc: In function 'std::string reverse(int, int, std::string)':
a.cc:25:27: error: cannot convert 'std::__cxx11::basic_string<char>::iterator' to 'int'
   25 |      rev=reverse(rev.begin(),rev.end());
      |                  ~~~~~~~~~^~
      |                           |
      |                           std::__cxx11::basic_string<char>::iterator
a.cc:23:20: note:   initializing argument 1 of 'std::string reverse(int, int, std::string)'
   23 | string reverse(int a,int b,string str){
      |                ~~~~^
a.cc:26:34: error: expected ';' before 'return'
   26 |      str=str.replace(a,b-a+1,rev)
      |                                  ^
      |                                  ;
   27 |      return str;
      |      ~~~~~~                       
a.cc:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
   28 | }
      | ^
a.cc: In function 'std::string replace(int, int, int, std::string)':
a.cc:31:6: error: 'stirng' was not declared in this scope
   31 |      stirng rep;
      |      ^~~~~~
a.cc:32:11: error: 'rep' was not declared in this scope
   32 |      cin>>rep;
      |           ^~~
Language: C++

#include <iostream>
#include <string>
using namespace std;
  
int main () {
    int a,b,n,i;
    char c;
    string str,s,f,g;
    cin >> str;
    cin >> n;
    for(i=1;i<=n;i++){
        cin >> s >>a >> b;
        if(s[2]=='i'){cout << str.substr(a,b-a+1) << endl;}
        else if(s[2]=='v'){
            str = str.reverse(a,b-a+1);
        }
        else if(s[2]=='p'){
            cin >> g;
            str = str.replace(a,b-a+1,g);
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:23: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'reverse'; did you mean 'reserve'?
   15 |             str = str.reverse(a,b-a+1);
      |                       ^~~~~~~
      |                       reserve
Language: C++

#include <iostream>
#include <sstream>

int main(int argc, char const *argv[]) {
  std::string str;
  std::cin >> str;
  int x;
  std::cin >> x;
  for(int i=0;i<x;i++){
    std::string order;
    std::cin >> order;
    if(order == "replace"){
      int a,b;
      std::string s;
      std::cin >> a >> b >> s;
      str.replace(a,b-a+1,s);
    }else if(order == "reverse"){
      int a,b;
      std::cin >> a >> b;
      reverse(str.begin() + a, str.begin() + b + 1);
    }else if(order == "print"){
      int a,b;
      std::cin >> a >> b;
      std::string print;
      print = str.substr(a,b-a+1);
      std::cout << print << std::endl;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:20:7: error: 'reverse' was not declared in this scope
   20 |       reverse(str.begin() + a, str.begin() + b + 1);
      |       ^~~~~~~
Language: C++

#include<string>
#include<iostream>
using namespace std;


int main(){
  string str;
  cin >> str;
  int q;
  cin >> q;

  for (int i = 0; i < q; i++){
    string com, strpr, p;
    int a, b;
    cin >> com >> a >> b;
    if (com == "print") cout << str.substr(a, b-a+1) << endl;
    else if (com == "reverse") {
      string tmp = str.substr(a, b-a+1);
      int n = tmp.size();
      for (int i = 0; i < n; i++){str[i+a] = tmp[n-i-1];
      }
    else if (com == "replace") {cin >> p; str = str.replace(a, b-a+1, p);}

}

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: expected '}' before 'else'
   22 |     else if (com == "replace") {cin >> p; str = str.replace(a, b-a+1, p);}
      |     ^~~~
a.cc:17:32: note: to match this '{'
   17 |     else if (com == "reverse") {
      |                                ^
Language: C++


#include <iostream>
#include <vector>
#include <string>
#include <sstream>

using namespace std;

typedef vector<string> StringList;

void exeOrder(string &src, const StringList &order)
{
    int a = stoi(order[1]);
    int b = stoi(order[2]);
    if(order[0] == "print")
    {
        cout << src.substr(a,  b - a + 1) << endl;
    }
    else if(order[0] == "reverse")
    {
        string rev = src.substr(a, b - a + 1);
        reverse(rev.begin(), rev.end());
        src = src.substr(0, a) + rev + src.substr(b+1);

    }
    else if(order[0] == "replace")
    {
        src = src.substr(0, a) + order[3] + src.substr(b+1);
    }
}

int main()
{
    string str;
    getline(cin, str);

    string buf;
    getline(cin, buf);
    int n = stoi(buf);
    for(int i = 0; i < n; i++)
    {
        getline(cin, buf);
        stringstream ss(buf);

        StringList list;
        string tmp;
        while(getline(ss, tmp, ' '))
        {
            list.push_back(tmp);
        }
        exeOrder(str, list);

    }

    return 0;
}

Compiler output:
a.cc: In function 'void exeOrder(std::string&, const StringList&)':
a.cc:22:9: error: 'reverse' was not declared in this scope
   22 |         reverse(rev.begin(), rev.end());
      |         ^~~~~~~
Language: C++

import java.util.Scanner;

public class Main {
	private static Scanner sc=new Scanner(System.in);
	private static String str=sc.next();
	private static int q=sc.nextInt();
	public static void main(String[] args){
		for(int i=0;i<q;i++){
			String command=sc.next();
			if(command.equals("print")) print();
			if(command.equals("reverse")) reverse();
			if(command.equals("replace")) replace();
		}
	}
	private static void print(){
		int a=sc.nextInt();
		int b=sc.nextInt();
		System.out.println(str.substring(a,b+1));
	}
	private static void reverse(){
		int a=sc.nextInt();
		int b=sc.nextInt();
		String rev="";
		for(int i=b;i>=a;i--){
			rev=rev+String.valueOf(str.charAt(i));
		}
		str=str.substring(0,a)+rev+str.substring(b+1);
	}
	private static void replace(){
		int a=sc.nextInt();
		int b=sc.nextInt();
		String p=sc.next();
		StringBuilder buff=new StringBuilder();
		buff.append(str.substring(0,a));
		buff.append(p);
		buff.append(str.substring(b+1));
		str=buff.toString();
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

int main() {
	char str_c[1001];
	scanf("%s", str_c);
	string str(str_c);

	int num_q;
	scanf("%d", &num_q);

	int i, j;
	char cmd_c[100];
	string cmd;
	int a, b;
	char repl_c[1001];
	string repl;
	int num_read;
	string line;
	i = 0;
	string new_str;
	while(1) {
		getline(cin, line);
		if(line == "") {
			continue;
		} else {
			i++;
		}
		sscanf(line.c_str(), "%s", cmd_c);
		cmd = string(cmd_c);
		if(cmd == "replace") {
			sscanf(line.c_str(), "%s %d %d %s", cmd_c, &a, &b, repl_c);
			repl = string(repl_c);
			//printf("%s %d %d %s\n", cmd_c, a, b, repl_c);
			str.replace(a, b, repl);
			//printf("-> %s\n", str.c_str());
		} else {
			sscanf(line.c_str(), "%s %d %d", cmd_c, &a, &b);
			//printf("%s %d %d\n", cmd_c, a, b);
			if(cmd == "reverse") {
				for(j = a; j <= b; j++) {
					new_str = string(str);
					new_str[j] = str[b + a - j];
				}
				str = string(new_str);
				//printf("-> %s\n", str.c_str());
			} else {
				print(str.substr(a, b).c_str());
				//new_str = str.substr(a, b);
				//str = string(new_str);
				//printf("%s\n", str.c_str());
			}
		}
		if(i >= num_q) {
			//printf("%s\n", str.c_str());
			break;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:33: error: 'print' was not declared in this scope; did you mean 'printf'?
   51 |                                 print(str.substr(a, b).c_str());
      |                                 ^~~~~
      |                                 printf
Language: C++

#include<iostream>
#include<string>
using namespace std;

int main( ){
  string name,cp,sirei,p;
  int q,a,b,na;
  cin>>name>>q;
  na=(int)name.size();
  for(int i=0;i<q;i++){
    cin>>sirei;
    if(sirei=="print"){
      cin>>a>>b;
      cout<<name.substr(a,b-a+1)<<endl;
    }
    if(sirei=="reverse"){
      cin>>a>>b;
      for(int j=0;j<na;j++){
	cp[na-j-1]=name[j];
      }
      name=name.replace(a,b-a+1,cp.substr(na-b,b-a+1));
    }
    if(sirei=="replace"){
      cin>>a>>b>>p;
      name=name.replace(a,b-a+1,p);
    }
  }
  return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:28:12: error: expected '}' at end of input
   28 |   return 0;
      |            ^
a.cc:5:12: note: to match this '{'
    5 | int main( ){
      |            ^
Language: C++

#include "string"
#include "iostream"


int main()
{
	std::string str, cmd, rep, temp, temp1, temp2, revtemp = { "" }; \;
	int q, cmdn1, cmdn2;
	std::cin >> str;
	std::cin >> q;
	for (int i = 0; i < q; i++) {
		std::cin >> cmd >> cmdn1 >> cmdn2;
		if (cmd == "replace") {
			std::cin >> rep;
			str = str.replace(cmdn1, cmdn2 - cmdn1 + 1, rep);
		}
		if (cmd == "print")
			std::cout << str.substr(cmdn1, cmdn2 - cmdn1 + 1) << std::endl;
		if (cmd == "reverse") {
			temp = str.substr(cmdn1, cmdn2 - cmdn1 + 1);
			temp1 = str.substr(0, cmdn1);
			temp2 = str.substr(cmdn2 + 1);
			for (int j = temp.length() - 1; j >= 0; j--) {
				revtemp += temp[j];
			}
			str = temp1 + revtemp + temp2;
			revtemp = { "" };
		}
	}
    return 0;
}

Compiler output:
a.cc:7:74: error: stray '\' in program
    7 |         std::string str, cmd, rep, temp, temp1, temp2, revtemp = { "" }; \;
      |                                                                          ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
using namespace std;

int main(){

    string str;
    int q;

    cin >> str;
    cin >> q;
    int a, b;
    rep(i,0,q){
        string order;
        cin >> order;
        string temp;
        int a, b;
        if(order == "replace"){
            cin >>  temp;
            str.replace(a, b, temp);
        }else if(order == "reverse"){
            reverse(str.begin()+a, str.begin()+b+1);
        }else(order == "print"){
            cout << str.substr(a, b+1) << endl;
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:32: error: expected ';' before '{' token
   25 |         }else(order == "print"){
      |                                ^
      |                                ;
a.cc:25:21: warning: ignoring return value of 'bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*) [with _CharT = char; _Traits = char_traits<char>; _Alloc = allocator<char>]', declared with attribute 'nodiscard' [-Wunused-result]
   25 |         }else(order == "print"){
      |              ~~~~~~~^~~~~~~~~~~
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:3772:5: note: declared here
 3772 |     operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
int main() {
    string s; cin >> s;
    int n; cin >> n;
    int a, b;
    string t, ss;
    rep(i, 0, n) {
        cin >> t >> a >> b;
        if(t == "replace"){
            cin >> ss;
            s.replace(a, b - a + 1, ss);
        } else if (t == "reverse") {
            reverse(s.begin() + a, s.begin() + b + 1);
        } else {
            P(s.substr(a, b - a + 1));
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: 'P' was not declared in this scope
   17 |             P(s.substr(a, b - a + 1));
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a); i>n; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
int main() {
    string s; cin >> s;
    int n; cin >> n;
    int a, b;
    string t, ss;
    rep(i, 0, n) {
        cin >> t >> a >> b;
        if(t == "replace"){
            cin >> ss;
            s.replace(a, b - a + 1, ss);
        } else if (t == "reverse") {
            reverse(s.begin() + a, s.begin() + b + 1);
        } else {
            P(s.substr(a, b - a + 1));
        }
    }
    return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:36:14: error: expected '}' at end of input
   36 |     return 0;
      |              ^
a.cc:20:12: note: to match this '{'
   20 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <string>
using namespace std;

string check(int num);

int main(){
	int n;
	string str,ord;
	cin >> str;
	cin >> n;
	
	for(int i = 0;i < n;i++){
		int a,b;
		cin >> ord >> a >> b;
		if(ord == "print"){
			cout << str.substr(a,b-a+1) << "\n";
		}
		else if(ord == "reverse"){
			reverse(str.begin()+a, str.begin()+b+1);
		}
		else if(ord == "replace"){
			string c;
			cin >> c;
			str = str.substr(0,a) + c + str.substr(b+1);
		}
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:25: error: 'reverse' was not declared in this scope
   20 |                         reverse(str.begin()+a, str.begin()+b+1);
      |                         ^~~~~~~
Language: C++

#include <iostream>
#include <string>
using namespace std;

string check(int num);

int main(){
	int n;
	string str,ord;
	cin >> str;
	cin >> n;
	
	for(int i = 0;i < n;i++){
		int a,b;
		cin >> ord >> a >> b;
		int len = b-a+1;
		if(ord == "print"){
			cout << str.substr(a,len) << "\n";
		}
		else if(ord == "reverse"){
			string swap = str.substr(a,len);
			reverse(swap.begin(), swap.end());
			str = str.substr(0,a) + swap + str.substr(b+1);
		}
		else if(ord == "replace"){
			string c;
			cin >> c;
			str = str.substr(0,a) + c + str.substr(b+1);
		}
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:25: error: 'reverse' was not declared in this scope
   22 |                         reverse(swap.begin(), swap.end());
      |                         ^~~~~~~
Language: C++

#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
using namespace std;

int main()
{
	string str;

	string allow;

	string replacechar;

	int S, E;

	char a;

	int q;

	cin >> str;

	cin >> q;

	for (int i = 0; i < q; i++)
	{
		cin >> allow;

		if (allow=="replace")
		{
			cin >> S >> E;

			cin >> replacechar;

			str.replace(S, E, replacechar);
		}
		else if (allow=="reverse")
		{
			cin >> S >> E;

			reverse(str.begin()+S,str.end()-E);
		}
		else if (allow=="print")
		{
			cin >> S >> E;

			for (int j = S; j <= E; j++)
			{
				cout << str[j];
			}

			cout << endl;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:25: error: 'reverse' was not declared in this scope
   41 |                         reverse(str.begin()+S,str.end()-E);
      |                         ^~~~~~~
Language: C++

#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
using namespace std;

int main()
{
	string str;

	string allow;

	string replacechar;

	int S, E;

	char a;

	int q;

	cin >> str;

	cin >> q;

	for (int i = 0; i < q; i++)
	{
		cin >> allow;

		if (allow=="replace")
		{
			cin >> S >> E;

			cin >> replacechar;

			str.replace(S, E, replacechar);
		}
		else if (allow=="reverse")
		{
			cin >> S >> E;

			std::reverse(str.begin()+S,str.end()-E);
		}
		else if (allow=="print")
		{
			cin >> S >> E;

			for (int j = S; j <= E; j++)
			{
				cout << str[j];
			}

			cout << endl;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:30: error: 'reverse' is not a member of 'std'
   41 |                         std::reverse(str.begin()+S,str.end()-E);
      |                              ^~~~~~~
Language: C++

#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
using namespace std;

int main()
{
	string str;

	string allow;

	string replacechar;

	int S, E;



	int q;

	cin >> str;

	cin >> q;

	for (int i = 0; i < q; i++)
	{
		cin >> allow;

		if (allow=="replace")
		{
			cin >> S >> E;

			int i = 0;

			cin >> replacechar;

			for (int j = S; j <= E; j++)
			{

				str[j] = replacechar[i];

				i++;
			}
		}
		else if (allow=="reverse")
		{
			cin >> S >> E;

			reverse(str.begin()+S,str.end()-E);
		}
		else if (allow=="print")
		{
			cin >> S >> E;

			for (int j = S; j <= E; j++)
			{
				cout << str[j];
			}

			cout << endl;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:25: error: 'reverse' was not declared in this scope
   49 |                         reverse(str.begin()+S,str.end()-E);
      |                         ^~~~~~~
Language: C++

#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
using namespace std;

int main()
{
	string str;

	string allow;

	string replacechar;

	int S, E;

	string a;

	int q;

	cin >> str;

	cin >> q;

	for (int i = 0; i < q; i++)
	{
		cin >> allow >> S >> E;

		if (allow=="replace")
		{

			cin >> replacechar;

			str.replace(S, E-S+1, replacechar);
		}
		else if (allow=="reverse")
		{

			string B = str.substr(S, E - S + 1);

			reverse(B.begin(),B.end());

			str.replace(S,E-S+1,B);

		}
		else if (allow=="print")
		{

			cout << str.substr(S,E-S+1);

			cout << endl;
		}
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:25: error: 'reverse' was not declared in this scope
   41 |                         reverse(B.begin(),B.end());
      |                         ^~~~~~~
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main()
{
	string qn,str;
	int q;
	cin >> str >> q;
	for (int i = 0 ; i < q ; i++ ){
		cin >> qn;
		if (qn == relace){
			cin >> a >> b >> p;
			for (j = a ; j < b ; j++ ){
				str[i] = p[i];
			}
		} 

		if (qn == reverse){
			cin >> a >> b;
			for (int x = a ; x < b ; x++ ){
				for (int y = b ; y < a ; y++ ){
                    str[x] = str[y];
				}
			}
		}
		
		if (qn == print){
			cin >> a >> b;
			for (int k = a ; k < b ; k++ ){
				cout << str[k];
			}
		}
	}

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:27: error: 'relace' was not declared in this scope; did you mean 'rename'?
   13 |                 if (qn == relace){
      |                           ^~~~~~
      |                           rename
a.cc:14:32: error: 'a' was not declared in this scope
   14 |                         cin >> a >> b >> p;
      |                                ^
a.cc:14:37: error: 'b' was not declared in this scope
   14 |                         cin >> a >> b >> p;
      |                                     ^
a.cc:14:42: error: 'p' was not declared in this scope
   14 |                         cin >> a >> b >> p;
      |                                          ^
a.cc:15:30: error: 'j' was not declared in this scope
   15 |                         for (j = a ; j < b ; j++ ){
      |                              ^
a.cc:20:27: error: 'reverse' was not declared in this scope
   20 |                 if (qn == reverse){
      |                           ^~~~~~~
a.cc:21:32: error: 'a' was not declared in this scope
   21 |                         cin >> a >> b;
      |                                ^
a.cc:21:37: error: 'b' was not declared in this scope
   21 |                         cin >> a >> b;
      |                                     ^
a.cc:29:27: error: 'print' was not declared in this scope; did you mean 'printf'?
   29 |                 if (qn == print){
      |                           ^~~~~
      |                           printf
a.cc:30:32: error: 'a' was not declared in this scope
   30 |                         cin >> a >> b;
      |                                ^
a.cc:30:37: error: 'b' was not declared in this scope
   30 |                         cin >> a >> b;
      |                                     ^
Language: C++

#include	<iostream>
#include	<string>
using namespace std;

int main()
{
	string		str;
	int			ComCnt;

	cin >> str;
	cin >> ComCnt;

	string		Command;
	int			a, b;
	string		PreStr;
	string		SubStr;
	string		PostStr;

	for (int i = 0; i < ComCnt; i++)
	{
		cin >> Command;
		if (Command == "print")
		{
			cin >> a >> b;
			cout << str.substr(a, b + 1) << endl;
		}
		else if (Command == "reverse")
		{
			cin >> a >> b;
			PreStr = str.substr(0, a);
			SubStr = str.substr(a, b + 1);
			reverse(begin(SubStr), end(SubStr));
			PostStr = str.substr(b + 1);
			str = PreStr + SubStr + PostStr;
		}
		else if (Command == "replace")
		{
			cin >> a >> b >> SubStr;
			PreStr = str.substr(0, a);
			PostStr = str.substr(b + 1);
			str = PreStr + SubStr + PostStr;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:25: error: 'reverse' was not declared in this scope
   32 |                         reverse(begin(SubStr), end(SubStr));
      |                         ^~~~~~~
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main()
{
	string qn,str;
	int q;
	cin >> str >> q;
	for (int i = 0 ; i < q ; i++ ){
		cin >> qn;
		if (qn == "relace"){
			cin >> a >> b >> p;
			for (j = a ; j < b ; j++ ){
				str[i] = p[i];
			}
		} 

		if (qn == "reverse"){
			cin >> a >> b;
			for (int x = a ; x < b ; x++ ){
				for (int y = b ; y < a ; y++ ){
                    str[x] = str[y];
				}
			}
		}
		
		if (qn == "print"){
			cin >> a >> b;
			for (int k = a ; k < b ; k++ ){
				cout << str[k];
			}
		}
	}

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:32: error: 'a' was not declared in this scope
   14 |                         cin >> a >> b >> p;
      |                                ^
a.cc:14:37: error: 'b' was not declared in this scope
   14 |                         cin >> a >> b >> p;
      |                                     ^
a.cc:14:42: error: 'p' was not declared in this scope
   14 |                         cin >> a >> b >> p;
      |                                          ^
a.cc:15:30: error: 'j' was not declared in this scope
   15 |                         for (j = a ; j < b ; j++ ){
      |                              ^
a.cc:21:32: error: 'a' was not declared in this scope
   21 |                         cin >> a >> b;
      |                                ^
a.cc:21:37: error: 'b' was not declared in this scope
   21 |                         cin >> a >> b;
      |                                     ^
a.cc:30:32: error: 'a' was not declared in this scope
   30 |                         cin >> a >> b;
      |                                ^
a.cc:30:37: error: 'b' was not declared in this scope
   30 |                         cin >> a >> b;
      |                                     ^
Language: C++

#include<iostream>
#include<string>
using namespace std;

int main(){

  int q, a, b;
  string str, tmp, command, p;

  cin>>str;
  cin>>q;
  for(int i=0;i<q;i++){
    cin>>command>>a>>b;
    if(command=="print"){
      cout<<str.substr(a, b-a+1)<<endl;
    }else if(command=="reverse"){
      tmp=str.substr(a, b-a+1);
      reverse(tmp.begin(), tmp.end());
      str=str.substr(0, a)+tmp+str.substr(b+1, str.size()-a-1);
    }else if(command=="replace"){
      cin>>p;
      str=str.substr(0, a)+p+str.substr(b+1, str.size()-a-1);
    }
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:7: error: 'reverse' was not declared in this scope
   18 |       reverse(tmp.begin(), tmp.end());
      |       ^~~~~~~
Language: C++

/*
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_9_D
 */
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int
main()
{
  ios::sync_with_stdio(false);

  string line;
  getline(cin, line);

  int n;
  cin >> n; cin.ignore();

  for (int i = 0; i < n; i++) {
    string cmd;
    int p1, p2;
    cin >> cmd >> p1 >> p2;

    if (cmd == "replace") {
      string r;
      cin >> r;
      line.replace(p1, p2 - p1 + 1, r);
    } else if (cmd == "reverse") {
      reverse(line.begin() + p1, line.begin() + p2 + 1);
    } else if (cmd == "print") {
      cout << line.substr(p1, p2 - p1 + 1) << endl;
    }
    cin.ignore();
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:7: error: 'reverse' was not declared in this scope
   31 |       reverse(line.begin() + p1, line.begin() + p2 + 1);
      |       ^~~~~~~
Language: C++

  getline(cin, line);

  int n;
  cin >> n; cin.ignore();

  for (int i = 0; i < n; i++) {
    string cmd;
    int p1, p2;
    cin >> cmd >> p1 >> p2;

    if (cmd == "replace") {
      string r;
      cin >> r;
      line.replace(p1, p2 - p1 + 1, r);
    } else if (cmd == "reverse") {
      reverse(line.begin() + p1, line.begin() + p2 + 1);
    } else if (cmd == "print") {
      cout << line.substr(p1, p2 - p1 + 1) << endl;
    }
    cin.ignore();
  }

  return 0;
}

Compiler output:
a.cc:1:10: error: expected constructor, destructor, or type conversion before '(' token
    1 |   getline(cin, line);
      |          ^
a.cc:4:3: error: 'cin' does not name a type
    4 |   cin >> n; cin.ignore();
      |   ^~~
a.cc:4:13: error: 'cin' does not name a type
    4 |   cin >> n; cin.ignore();
      |             ^~~
a.cc:6:3: error: expected unqualified-id before 'for'
    6 |   for (int i = 0; i < n; i++) {
      |   ^~~
a.cc:6:19: error: 'i' does not name a type
    6 |   for (int i = 0; i < n; i++) {
      |                   ^
a.cc:6:26: error: 'i' does not name a type
    6 |   for (int i = 0; i < n; i++) {
      |                          ^
a.cc:23:3: error: expected unqualified-id before 'return'
   23 |   return 0;
      |   ^~~~~~
a.cc:24:1: error: expected declaration before '}' token
   24 | }
      | ^
Language: C++

#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(void){
	int a,b,q,i,ii,j,R1,R2=0;int len;
	string p,str,command,r,Reverse;
	while(cin>>str,cin>>q){
		for(i = 0;i < q;i++){
			cin>>command;
			if(command == "print"){
				cin>>a>>b;
				cout<<str.substr(a,b)<<endl;
			}
			if(command == " reverse"){
				cin>>a>>b;
				reverse(str.(a,b).begin(),str.(a,b).end());
				/*
				len = str.substr(a,b).length();
				for(R1 = len ; 0<R1;R1--){
					r[R2] += str.substr(a,b)[R1];
					R2++;
				}
				R2 = 0;
				str = str.substr(0,a) + r + str.substr(b,str.length());
				/*
				Reverse = str.substr(a,b);
				for(R1=0,R2=str.substr(a,b).size();R1<str.substr(a,b).size(),R2>0;R1++,R2--){
					r+= Reverse[R2] ;
				}
				str = str.substr(0,a) + r + str.substr(b,str.substr(a,b).length());
				*/
			}
			if(command == "replace"){
				cin>>a>>b>>p;
				str.substr(a,b) = p;		
				str = str.substr(0,a) + p + str.substr(b,str.length());
			
			}
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:45: error: expected unqualified-id before '(' token
   18 |                                 reverse(str.(a,b).begin(),str.(a,b).end());
      |                                             ^
a.cc:18:63: error: expected unqualified-id before '(' token
   18 |                                 reverse(str.(a,b).begin(),str.(a,b).end());
      |                                                               ^
Language: C++

#include <iostream>
#inculde <string>

using namespace std;

int main(void) {

	int number;
	string str;
	cin >> str >> number;


	for (int i = 0; i<number; i++) {
		string com;
		cin >> com;

		if (com == "replace") {
			int n1, n2;
			string str2;
			cin >> n1 >> n2 >> str2;
			str.replace(n1, n2 - n1, str2);
		}
		else if (com == "reverse") {
			int n1, n2;
			cin >> n1 >> n2;
			reverse(str[n1], str[n2]);
		}
		else if (com == "print") {
			int n1, n2;
			cin >> n1 >> n2;
			for (int i = n1; i <= n2; i++)
				cout << str[i];
			cout << endl;
		}
	}

	return 0;
}

Compiler output:
a.cc:2:2: error: invalid preprocessing directive #inculde; did you mean #include?
    2 | #inculde <string>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:26:25: error: 'reverse' was not declared in this scope
   26 |                         reverse(str[n1], str[n2]);
      |                         ^~~~~~~
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main(void) {

	int number;
	string str;
	cin >> str >> number;


	for (int i = 0; i<number; i++) {
		string com;
		cin >> com;

		if (com == "replace") {
			int n1, n2;
			string str2;
			cin >> n1 >> n2 >> str2;
			str.replace(n1, n2 - n1, str2);
		}
		else if (com == "reverse") {
			int n1, n2;
			cin >> n1 >> n2;
			reverse(str[n1], str[n2]);
		}
		else if (com == "print") {
			int n1, n2;
			cin >> n1 >> n2;
			for (int i = n1; i <= n2; i++)
				cout << str[i];
			cout << endl;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:25: error: 'reverse' was not declared in this scope
   26 |                         reverse(str[n1], str[n2]);
      |                         ^~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(void) {

	int number;
	string str;
	cin >> str >> number;


	for (int i = 0; i<number; i++) {
		string com;
		cin >> com;

		if (com == "replace") {
			int n1, n2;
			string str2;
			cin >> n1 >> n2 >> str2;
			str.replace(n1, n2 - n1, str2);
		}
		else if (com == "reverse") {
			int n1, n2;
			cin >> n1 >> n2;
			reverse(str[n1], str[n2]);
		}
		else if (com == "print") {
			int n1, n2;
			cin >> n1 >> n2;
			for (int i = n1; i <= n2; i++)
				cout << str[i];
			cout << endl;
		}
	}

	return 0;
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::reverse(_BIter, _BIter) [with _BIter = char]':
a.cc:27:11:   required from here
   27 |                         reverse(str[n1], str[n2]);
      |                         ~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1089:63: error: no matching function for call to '__iterator_category(char&)'
 1089 |       std::__reverse(__first, __last, std::__iterator_category(__first));
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66,
                 from /usr/include/c++/14/string:47,
                 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/stl_iterator_base_types.h:239:5: note: candidate: 'template<class _Iter> constexpr typename std::iterator_traits< <template-parameter-1-1> >::iterator_category std::__iterator_category(const _Iter&)'
  239 |     __iterator_category(const _Iter&)
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_iterator_base_types.h: In substitution of 'template<class _Iter> constexpr typename std::iterator_traits< <template-parameter-1-1> >::iterator_category std::__iterator_category(const _Iter&) [with _Iter = char]':
/usr/include/c++/14/bits/stl_algo.h:1089:63:   required from 'void std::reverse(_BIter, _BIter) [with _BIter = char]'
 1089 |       std::__reverse(__first, __last, std::__iterator_category(__first));
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
a.cc:27:11:   required from here
   27 |                         reverse(str[n1], str[n2]);
      |                         ~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: error: no type named 'iterator_category' in 'struct std::iterator_traits<char>'
  239 |     __iterator_category(const _Iter&)
      |     ^~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(){
 string str,p,op;
 int a,b,q;

 cin >> str >> q;

 for(int i=0;i<q;i++){
  cin >> op >> a >> b;
  if(op=="print")cout << str.substr(a,b-a+1) << endl;
  else if(op=="reverse)reverse(s.begin()+1,s.begin()+b+1);
  else{
   cin >> p ;
   s=s.substr(0,a)+p+s.substr(b+1,s.length()-b-1);
  }
 return 0;
}

Compiler output:
a.cc:14:15: warning: missing terminating " character
   14 |   else if(op=="reverse)reverse(s.begin()+1,s.begin()+b+1);
      |               ^
a.cc:14:15: error: missing terminating " character
   14 |   else if(op=="reverse)reverse(s.begin()+1,s.begin()+b+1);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:15:3: error: expected primary-expression before 'else'
   15 |   else{
      |   ^~~~
a.cc:19:2: error: expected primary-expression before 'return'
   19 |  return 0;
      |  ^~~~~~
a.cc:18:4: error: expected ')' before 'return'
   18 |   }
      |    ^
      |    )
   19 |  return 0;
      |  ~~~~~~
a.cc:14:10: note: to match this '('
   14 |   else if(op=="reverse)reverse(s.begin()+1,s.begin()+b+1);
      |          ^
a.cc:20:2: error: expected '}' at end of input
   20 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^