For this Question: Given a number N in the form of a string, find the number of its good substrings.
A good substring is a substring that is divisible by the given prime p. A good substring can start with a 0.The first line of input contains a single number, the length of the string, |N|
The second line of input contains the number N.
The third and final line of input contains a prime number p.

Constraints
1 <= |N| <= 100000
2 <= p <= 10000
p is a prime numberThe only line of output contains the number of good substrings.Sample Input
4
3543
3

Sample Output
6

Explanation
Good substrings are 3, 354, 3543, 54, 543, 3, I have written this Solution Code: import java.io.*;
import java.util.*;



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

        int n = Integer.parseInt(br.readLine());
        String str = br.readLine();
        int p = Integer.parseInt(br.readLine());

        System.out.print(getCount(n, str, p));
	}

    static int getCount(int n, String str, int p){
        int count = 0;
        int[] arr = new int[p];
        arr[0] = 1;
        int curr = 0;
        int mul = 1;
        int num = 0;

        if(p == 2 || p == 5){
            for(int i=n-1; i>=0; i--){
                if(Character.getNumericValue(str.charAt(i))%p == 0){
                    count+=i+1;
                }
            }
            return count;
        }

        for(int i=n-1; i>=0; i--){
            int dig = str.charAt(i)-'0';
            dig*=mul;
            dig%=p;
            curr += dig;
            curr %= p;
            count += arr[curr];
            arr[curr]++;
            mul *= 10;
            mul %= p;
        }

        return count;

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