package Main;
import java.text.ParseException;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
public class Main {
static Scanner cin = new Scanner(System.in);
static int max;
static Character c = null;
public static void main(String[] args) throws ParseException {
String str = cin.nextLine();
Map<Character, Integer> map = new LinkedHashMap<Character, Integer>();
char[] s = str.toCharArray();
for (int i = 0; i < str.length(); i++) {
if (map.containsKey(str.charAt(i))) {
map.put(s[i], map.get(s[i]) + 1);
if (map.get(s[i]) > max) {
max = map.get(s[i]);
}
} else {
map.put(s[i], 1);
if (max == 0)
max = 1;
}
}
Set<Character> set = map.keySet();
for (Character i : set)
if (map.get(i) == max) {
// System.out.println(i);
if (c == null)
c = i;
else if (i.charValue() < c.charValue())
c = i;
}
System.out.println(c);
System.out.println(max);
}
}