For this Question: You are given a string S of length N consisting of lowercase characters 'a' and 'b'. In one operation, you can select a character and make it equal to one of its adjacent characters. For example, if S = "aab", in one operation you can convert it to any of the following:

1. "aab": By changing the 1<sup>st</sup> character to the 2<sup>nd</sup> character.
2. "aab": By changing the 2<sup>nd</sup> character to the 1<sup>st</sup> character.
3. "abb": By changing the 2<sup>nd</sup> character to the 3<sup>rd</sup> character.
4. "aaa": By changing the 3<sup>rd</sup> character to the 2<sup>nd</sup> character.

Find the minimum number of operations to make all the characters in the string equal.The first line of the input contains a single integer N.
The second line contains a string S of length N consisting of only 'a' and 'b'.

<b> Constraints: </b>
1 ≤ N ≤ 5000Print the minimum number of operations to make all the characters in the string equal.Sample Input 1:
4
abaa

Sample Output 1:
1

Sample Explanation 1:
You can replace the 'b' at the second position by the 'a' at the first position. Now the string becomes "aaaa". 

Sample Input 2:
5
bbbaa

Sample Output 2:
2

, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args) throws Exception{

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int c = 0;
        String str = br.readLine();
        for(int i=0;i<n;i++){
            if(str.charAt(i) == 'a'){
                c++;
            }
        }
        if((n-c)<c){
            System.out.println(n-c);
        }else{
            System.out.println(c);
        }

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