from collections import Counter # 入力(16進) n = int(input().strip(), 16) # 8進数に変換 n = oct(n) # 出現頻度が最も多い文字を取得 for k, v in Counter(n).most_common(): print(k, v) break