Time limit
2s
Memory limit
128 MB
A string S consisting only of decimal digits is given. Count how many ways parentheses and spaces can be restored so that the string becomes a valid base representation.
A representation is defined as follows.
b. The base must be an integer at least 2 and must not have unnecessary leading zeros.0 <= d < b.0.Even if two representations denote the same numeric value, they are counted separately when their split positions are different.
The first line contains a string S consisting only of decimal digits. The length of S is at most 35.
Print the number of possible representations.