what’s the error in my code----
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
int k = cin.nextInt();
String str = cin.nextLine();
int counta = 0, countb =0;
for(int i = 0;i<str.length();i++){
if(str.charAt(i) == ‘a’){
counta++;
}else{
countb++;
}
}
int count = 0;
char ch1 = ‘a’, ch2 = ‘b’;
if(counta>countb){
while(count<=k){
for(int i = 0;i<str.length();i++){
if(str.charAt(i) == ‘b’){
str.charAt(i) = ch1;
count++;
}
}
}
}else{
while(count<=k){
for(int i = 0;i<str.length();i++){
if(str.charAt(i) == ‘a’){
str.charAt(i) = ch2;
count++;
}
}
}
}
System.out.println(str);
}
}