For this Question: Given two strings A and B. The task is to find if the string A can be obtained by rotating the string B by 2 places.The first line of the input contains the string A.
The second line of the input contains the string B.

Constaint:-

1 <= |A|, |B| <= 100Print 1 if the string A can be obtained by rotating string B by two places, else print 0.Sample Input:
amazon
azonam

Sample Output:
1

Input: string1 = “amazon”, string2 = “azonam”
Output: Yes
// rotated anti-clockwise

Input: string1 = “amazon”, string2 = “onamaz”
Output: Yes
// rotated clockwise, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args) throws IOException{

		BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));

		String string1 = rd.readLine();
		String string2 = rd.readLine();

		int size1 = string1.length();
		int size2 = string2.length();

		int result = check(string1, string2, size1, size2);
		System.out.println(result);

	}

	public static int check(String string1, String string2, int size1, int size2){

		boolean flag = true;

		if(size1 != size2){
			return 0;
		}
		if(size1 < 2){

			if(string1.equals(string2)){
				return 1;
			}else{
				return 0;
			}

		}

		for(int x = 0; x < size2; x++){
			char c = string2.charAt((x + size2 - 2) % size2);
			char c3 = string1.charAt(x);
			if(c != c3){
				flag = false;
				break;
			}
		}

		if(flag == false){
			for(int x = 0; x < size2; x++){
				char c2 = string2.charAt((x + 2) % size2);
				char c3 = string1.charAt(x);
				if(c2 != c3){
					flag = false;
					break;
				}
			}
		}

		return (flag ? 1 : 0);

	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?