what is the error in my code—
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
String str = cin.next();
Max(str);
}
public static void Max(String str){
int max = 0;
StringBuilder st = new StringBuilder("");
for(int i = 0;i<str.length();i++){
int count =0;
for(int j = 0;j<str.length();j++){
if(str.charAt(i) == str.charAt(j)){
count ++;
}
}
if(max<count){
max = count ;
st.append(str.charAt(i));
}
}
System.out.print(st);
}
}