For this Question: Given an integer N such that no digit of N is 0, find minimum numbers of digits that need to be removed from N such that N becomes divisible by 3. Note: if all the digits of N needs to removed report -1.Input contains a single integer N.

Constraints:
1 <= N <= 10^18
No digit of N is 0.Print the minimum number of digits that needs to removed to make N divisible by 3. Note: if all the digits of N needs to removed report -1.Sample Input 1
35

Sample Output 1
1

Explanation: we remove 5 from 35 making it 3.

Sample Input 2
44

Sample Output 2
-1

Explanation: As we have to remove all digits we report -1., I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args)throws IOException {
     BufferedReader s=new BufferedReader(new InputStreamReader(System.in));

	 String S=s.readLine();
     int arr[]=new int[3];

	 for(int i=0;i<3;i++){
		 arr[i]=0;
	 }
	 int sum=0;
	 for(int i=0;i<S.length();i++){

		 sum+=(int)S.charAt(i);
		 int num=(int)S.charAt(i);
		 int rem=num%3;
		 if(rem==0){
			 arr[0]++;
		 }
		 if(rem==1){
			 arr[1]++;
		 }
		 if(rem==2){
			 arr[2]++;
		 }
	 }
      int cnt=S.length();
	 if(sum % 3 == 0)
{

		System.out.println("0");

	}

	else if(sum % 3 == 1)
{

		if(arr[1]>=1 && cnt > 1)
{

			System.out.println("1");

		}

		else if(arr[2] >= 2 && cnt > 2)
{

			System.out.println("2");

		}

		else
{

			System.out.println("-1");

		}

	}

	else if(sum % 3 == 2)
{

		if(arr[2]>=1 && cnt > 1)
{

			System.out.println("1");

		}

		else if(arr[1] >= 2 && cnt > 2)

		{

			System.out.println("2");

		}

		else

		{

			System.out.println("-1");

		}

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