Language: Java


import java.util.Scanner;

public class ren2 {

	static String strOrder ="";

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		//???????????????????????????
	//	System.out.println("??????????????\?????????????????????");
		String strInput = sc.nextLine();

		String[] arrayStrInput = new String[strInput.length()];

		//?????????????????????????????????????´??????????
		for(int i = 0; i < strInput.length(); i++) {
			arrayStrInput[i] = strInput.substring(i, i+1);
		}

		//????????°?????\???
	//	System.out.println("??????????????????????????\?????????????????????");
		String strNum = sc.nextLine();
		int intNum = Integer.parseInt(strNum);

	//	System.out.println(intNum);

		String[] strOrder = new String[intNum];

		//????????????????????????
		for(int i = 0; i < intNum; i++){
	//		System.out.println("??????????????\?????????????????????");
			strOrder[i] = sc.nextLine();
		}
		for(int i = 0; i < strOrder.length; i++) {

			if(strOrder[i].indexOf("print") != -1) {
	//			System.out.println("print????????????????????????");
				orders1(strOrder[i], arrayStrInput);
			}
			else if(strOrder[i].indexOf("reverse") != -1) {
	//			System.out.println("reverse????????????????????????");
				arrayStrInput = orders2(strOrder[i], arrayStrInput);
			}
			else if(strOrder[i].indexOf("replace") != -1) {
	//			System.out.println("replace????????????????????????");
				arrayStrInput = orders3(strOrder[i], arrayStrInput);
			}

		}
	//	System.out.println("??????");
	}
	public static void orders1(String strOrder, String[] arrayStrInput) {
		//System.out.println("strOrder : "+strOrder);

		Scanner sc1 = new Scanner(strOrder);
		String Order = sc1.next();
		int intNum1 = sc1.nextInt();
		int intNum2 = sc1.nextInt();

		for(int i = intNum1; i <= intNum2; i++) {
			System.out.print(arrayStrInput[i]);
		}
		System.out.println("");
		//System.out.printf("%s %d %d",Order, intNum1, intNum2);
	}
	public static String[] orders2(String strOrder, String[] arrayStrInput) {
	//	System.out.println("orders2?????????????????????");
		Scanner sc1 = new Scanner(strOrder);
		String Order = sc1.next();
		int intNum1 = sc1.nextInt();
		int intNum2 = sc1.nextInt();

		int intMaxNum = intNum2;
		String strOkiba ="";

		for(int i = intNum1; i < intNum2; i++) {
			strOkiba = arrayStrInput[i];
			arrayStrInput[i] = arrayStrInput[intMaxNum];
			arrayStrInput[intMaxNum] = strOkiba;
			intMaxNum--;
		}
	//	System.out.printf("%s %d %d",Order, intNum1, intNum2);
		return arrayStrInput;
	}
	public static String[] orders3(String strOrder, String[] arrayStrInput) {
	//	System.out.println("orders3(replace)?????????????????????");
		Scanner sc1 = new Scanner(strOrder);
		String Order = sc1.next();
		int intNum1 = sc1.nextInt();
		int intNum2 = sc1.nextInt();
		String strNewWrite = sc1.next();
		String[] NewWrite = new String[strNewWrite.length()];

		for(int i = 0; i < strNewWrite.length(); i++) {
			NewWrite[i] = strNewWrite.substring(i, i+1);
		}
		int Count = 0;
		for(int i = intNum1; i <= intNum2; i++) {
			arrayStrInput[i] = NewWrite[Count];
			Count++;
		}
	//	for(String s : arrayStrInput) {
	//		System.out.println("??????????????????"+s);
	//	}
		return arrayStrInput;
		//System.out.printf("%s %d %d %s",Order, intNum1, intNum2, strNewWrite);
	}
}

Compiler output:
Main.java:4: error: class ren2 is public, should be declared in a file named ren2.java
public class ren2 {
       ^
1 error