ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

1179. Numbers in Text

Time limit: 1.0 second
Memory limit: 64 MB
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.

Input

Text consists of digits, capital Latin letters, spaces and line breaks. Size of input doesn’t exceed 1 Mb.

Output

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.

Sample

inputoutput
01234B56789
AZA
11 4
Problem Author: Pavel Atnashev
Problem Source: Third USU personal programming contest, Ekaterinburg, Russia, February 16, 2002