public static void main(String[] args) {
test("abbcccddddaa");
}
public static void test(String str) {
int max_length = 0;
String max_str = "";
while (str.length() > 0) {
int length = str.length();
String first = str.substring(0, 1);
str = str.replaceAll(first, "");
if (max_length < length - str.length()) {
max_length = length - str.length();
max_str = first;
}
}
System.out.println(max_length);
System.out.println(max_str);
}