import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int max = 0;
        int index = 0;
        String a = "abcdefghijklmnopqrstuvwxyz";
        int b[] = new int[26];
        for (int i = 0; i < s.length(); i++) {
            b[a.indexOf(s.charAt(i))]++;
        }
        for (int j = 0; j < b.length; j++) {
            if (b[j] > max) {
                max = b[j];
                index = j;
            }
        }
        System.out.println(a.substring(index, index + 1));
        System.out.println(max);
    }
}
