Not able to clear all test cases

Can you please explain what am I missing in this code because I am not able to clear all the test cases?

import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int ch = sc.nextInt();
sc.nextLine();
String str = sc.nextLine();
char[] arr = str.toCharArray();
int fa = 0;
int fb = 0;
for(int i=0; i<arr.length; i++){
if(arr[i]==‘a’){
fa++;
}
else{
fb++;
}
}
if(fa>=fb){
int j=0;
for(int i=0; i<arr.length; i++){
if(arr[i]==‘b’){
arr[i]=‘a’;
fa++;
j++;
}
if(j==ch || i==arr.length-1) {
break;
}

		}
		System.out.println(fa);
	}
	else if(fb>fa){
		int j=0;
		for(int i=0; i<arr.length; i++){
			if(arr[i]=='a'){
				arr[i]='b';
				fb++;
				j++;
			}
			if(j==ch || i==arr.length-1) {
				break;
			}
			
		}
		System.out.println(fb);
	}
}

}

Hi Aditya
Can you please share your code using coding blocks ide so that i can run your code easily and help you to find your mistake.