For this Question: On his birthday, newton was given an n*n matrix and instructions for it. The instruction consisted of symbols L and R where if the symbol L is given you need to rotate the matrix 90 degrees to the left, and for the symbol R you need to rotate the matrix 90 degrees to the right. The instruction was only 3 characters in length so newton could handle the twists with ease. Your task is to display the matrix that newton had at the end of these turns.<b>User Task:</b>
Since this will be a functional problem, you don't have to take input. You have to complete the function <b>Rotate()</b> that takes an integer n and 2d matrix a of size n*n and a string of length 3  as parameters.

<b>Constraints:</b>
1 &le; N &le; 500
Numbers can range from 1 to 500.Output the final matrix n*n.Sample Input:-
2
1 2
3 4
RLR
Sample Output:-
3 1
4 2, I have written this Solution Code: class Solution {

    
    public void Rotate(int n,int [][]a,String s) {
                    int l=0,r=0;
 
            for(char c:s.toCharArray()){
                if(c=='R')r++;
                else l++;
            }
 
            if(l==r){
                
                for(int i=0;i<n;i++){
                    for(int j=0;j<n;j++){
                        System.out.print(a[i][j]+" ");
                    }
                    System.out.println();
                }
            }
            else if(l>r){
                l=l-r;
                if(l%4==0){
                    for(int i=0;i<n;i++){
                    for(int j=0;j<n;j++){
                        System.out.print(a[i][j]+" ");
                    }
                    System.out.println();
                    }
                }else{
                    l=l%4;
                    for(int i=0;i<l;i++){
                        a=leftrotate(a,n);
                    }
                    for(int i=0;i<n;i++){
                    for(int j=0;j<n;j++){
                        System.out.print(a[i][j]+" ");
                    }
                    System.out.println();
                    }
                }
            }else{
                
                r=r-l;
                if(r%4==0){
                    for(int i=0;i<n;i++){
                    for(int j=0;j<n;j++){
                        System.out.print(a[i][j]+" ");
                    }
                    System.out.println();
                    }
                }else{
                    r=r%4;
                //out.println("wow"+" "+r);
 
                    for(int i=0;i<r;i++){
                        a=rightrotate(a,n);
                    }
                    for(int i=0;i<n;i++){
                    for(int j=0;j<n;j++){
                        System.out.print(a[i][j]+" ");
                    }
                    System.out.println();
                    }
                }
            }
            
    }
        int[][] leftrotate(int[][] a,int n){
 
          for(int i=0;i<n;i++){
              for(int j=i;j<n;j++){
                  int tmp = a[i][j];
                  a[i][j] = a[j][i];
                  a[j][i] = tmp;
 
              }
          }
 
        for(int i=0;i<n;i++){
 
            int low= 0;
            int high= n-1;
            while(low<high){
              int tmp = a[low][i];
              a[low][i] = a[high][i];
              a[high][i] = tmp;
              low++;
              high--;
            }
        }
        return a;
          
    }
    int[][] rightrotate(int[][] a,int n){
 
          for(int i=0;i<n;i++){
              for(int j=i;j<n;j++){
                  int tmp = a[i][j];
                  a[i][j] = a[j][i];
                  a[j][i] = tmp;
 
              }
          }
 
        for(int i=0;i<n;i++){
 
            int low= 0;
            int high= n-1;
            while(low<high){
              int tmp = a[i][low];
              a[i][low] = a[i][high];
              a[i][high] = tmp;
              low++;
              high--;
            }
        }
        return a;
          
    }
    
}
 
, In this Programming Language: Java, Now tell me if this Code is compilable or not?