For this Question: Given a string S. You can rearrange its letters in any way you want. You have to the find the maximum number of substrings in S which are equal to "abcda" after rearrangement.First line of input contains a single string S.

Constraints:
1 <= |S| <= 100000
String contains lowercase english letters.Output a single integer which is the maximum number of substrings in S which are equal to "abcda" after rearrangement.Sample Input
cbdaaabcda

Sample Output
2

Explanation : we can rearrange the given string as abcdaabcda, I have written this Solution Code: 

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        int a = -1 , b = 0, c= 0, d = 0;

        for(int i = 0 ; i < s.length() ; i++){
            if(s.charAt(i) == 'a')
                a++;
            else if(s.charAt(i) == 'b')
                b++;
            else if(s.charAt(i) == 'c')
                c++;
            else if(s.charAt(i) == 'd')
                d++;
        }
        if(a==-1)
        System.out.print(0);
        else
        System.out.print(findmin(a,b,c,d));
    }
    static int findmin(int a, int b, int c , int d){
        int f , s ;
        f = Math.min(a,b); s = Math.min(c, d);
        return Math.min(f,s);
    }

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