During building of roads, Akbardin read many statistical reports. Each report contained a lot of numbers. But different reports contained numbers in different numeric systems. And Akbardin asks his mathematicians a question – in what numeric system text contains maximal amount of numbers. Number is a sequence of digits, with non-digits to the left and right. Capital Latin letters are used in k-based system with k > 10 ('A' = 10, 'B' = 11, …, 'Z' = 35).
You task is to help mathematicians to solve this problem and save their heads.
Text consists of digits, capital Latin letters, spaces and line breaks.
Size of input doesn’t exceed 1 Mb.
Output should contain two integers: base of numeric system K (2 ≤ K ≤ 36) and amount of numbers. If more than one answer is possible, output the one with a less K.
Problem Author: Pavel Atnashev
Problem Source: Third USU personal programming contest, Ekaterinburg, Russia, February 16, 2002