For this Question: Given a string S. The letters are numbered from 1 to |S| from left to right. You have to perform M operations. In each operation, you will be given a number P<sub>i</sub>. You need to reverse the substring from P<sub>i</sub> to |S| - P<sub>i</sub> + 1. Print the final string after all the operations.

It is guaranteed that 2*P<sub>i</sub> <= |S|

|S| denotes the length of string SThe first line contains a string S. Second line contains a single integer M. Third line contains M space separated integers denoting the value of P<sub>i</sub>.

1 <= |S| <= 100000
1 <= M <= 100000
1 <= P<sub>i</sub> <= ceil(|S|/2)Print a single line containing the final string after all the operationsSample Input:
abcdef
3
1 2 3

Sample Output:
fbdcea

Explanation:
After 1st step, S = fedcba
After 2nd step, S = fbcdea
After 3rd step, S = fbdcea, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static String reverseString(String str)
	{
		StringBuilder s=new StringBuilder(str);
		int n=s.length();
		for(int i=0;i<n/2;i++)
		{
			char a=s.charAt(i);
			s.setCharAt(i,s.charAt(n-i-1));
			s.setCharAt(n-i-1,a);
		}
		return s.toString();
	}
	public static void main (String[] args) {
		Scanner scan=new Scanner(System.in);
		String s=scan.next();
		int q=scan.nextInt();
		String t="";
		int[] a=new int[(int)Math.ceil(s.length()/2.0)];
		while(q-->0)
		{
			t="";
			int p=scan.nextInt();
			a[p-1]=(a[p-1]==0)?1:0;
		}
		char[] arr=s.toCharArray();
		for(int i=1;i<a.length;i++)
		{
			a[i]=a[i]+a[i-1];
			a[i]=(a[i]==2)?0:a[i];
		}
		for(int i=0;i<a.length;i++)
		{
			if(a[i]==1)
			{
				char c=arr[i];
				arr[i]=arr[arr.length-i-1];
				arr[arr.length-i-1]=c;
			}
		}
		s=String.valueOf(arr);
		System.out.println(s);
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?