#P265. 练43.3算进制
练43.3算进制
Description
A number system is a method of counting with carry. We commonly use the decimal system, which carries over when reaching ten. A base- system carries over when reaching . In a base- system, each digit position can only contain numbers from to . For example, binary only uses and , ternary uses , , and , and decimal uses through .
For bases greater than 10, we use letters to represent digits: represents 10, represents 11, represents 12, and so on.
Given a positive integer in string form, determine the minimum base in which this number can appear.
Input Format
A single line containing a string of length not exceeding , consisting only of digits and uppercase letters, with no leading zeros.
Output Format
A single line containing an integer representing the minimum base in which this number can appear.
Sample
314