Language: C++

using System;

namespace ITP1_9_D
{
    class Program
    {
        static void Main(string[] args)
        {
          
            string str = Console.ReadLine();
            int q = int.Parse(Console.ReadLine());

            for(int i = 0; i < q; i++)
            {
                string[] input = Console.ReadLine().Split(' ');
                int a = int.Parse(input[1]);
                int b = int.Parse(input[2]);

                switch (input[0])
                {
                    case "print":
                        Console.WriteLine(str.Substring(a, b + 1));
                        break;
                    case "reverse":
                        string copy = null;
                        for (int j = b; j >= a; j--)
                            copy += str[j];
                        str = Setstr(a, b, copy);
                        break;
                    case "replace":
                        str = Setstr(a, b, input[3]);
                        break;
                    default:
                        break;
                }
            }
        }
        static string Setstr(int a,int b,string str)
        {
            string ret;

            if (a == 0) ret = str + str.Substring(b + 1);
            else if (b == 0) ret = str.Substring(0, a) + str;
            else ret = str.Substring(0, a + 1) + str + str.Substring(b + 1);

            return ret;
        }
    }
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:7:26: error: 'string' has not been declared
    7 |         static void Main(string[] args)
      |                          ^~~~~~
a.cc:7:35: error: expected ',' or '...' before 'args'
    7 |         static void Main(string[] args)
      |                                   ^~~~
a.cc:38:16: error: 'string' does not name a type
   38 |         static string Setstr(int a,int b,string str)
      |                ^~~~~~
a.cc:48:6: error: expected ';' after class definition
   48 |     }
      |      ^
      |      ;
a.cc: In static member function 'static void ITP1_9_D::Program::Main(int*)':
a.cc:10:13: error: 'string' was not declared in this scope
   10 |             string str = Console.ReadLine();
      |             ^~~~~~
a.cc:11:21: error: expected primary-expression before 'int'
   11 |             int q = int.Parse(Console.ReadLine());
      |                     ^~~
a.cc:15:24: error: expected primary-expression before ']' token
   15 |                 string[] input = Console.ReadLine().Split(' ');
      |                        ^
a.cc:16:25: error: expected primary-expression before 'int'
   16 |                 int a = int.Parse(input[1]);
      |                         ^~~
a.cc:17:25: error: expected primary-expression before 'int'
   17 |                 int b = int.Parse(input[2]);
      |                         ^~~
a.cc:19:25: error: 'input' was not declared in this scope; did you mean 'int'?
   19 |                 switch (input[0])
      |                         ^~~~~
      |                         int
a.cc:22:25: error: 'Console' was not declared in this scope
   22 |                         Console.WriteLine(str.Substring(a, b + 1));
      |                         ^~~~~~~
a.cc:22:43: error: 'str' was not declared in this scope; did you mean 'std'?
   22 |                         Console.WriteLine(str.Substring(a, b + 1));
      |                                           ^~~
      |                                           std
a.cc:25:32: error: expected ';' before 'copy'
   25 |                         string copy = null;
      |                                ^~~~
a.cc:27:29: error: 'copy' was not declared in this scope
   27 |                             copy += str[j];
      |                             ^~~~
a.cc:28:44: error: 'copy' was not declared in this scope
   28 |                         str = Setstr(a, b, copy);
      |                                            ^~~~
a.cc:28:31: error: 'Setstr' was not declared in this scope
   28 |                         str = Setstr(a, b, copy);
      |                               ^~~~~~