/* Input: number in k-notation. * Output: k-notation, 2 ≤ k ≤ 36. */ #include #define NUM_OFFSET '0' #define ALPH_OFFSET 55 int main( void ) { int sum = 0; int c, tmp, mx = 0; while(( c = getchar()) != EOF && c != '\n' ) { if( c >= '0' && c <= '9' ) tmp = c - NUM_OFFSET; else tmp = c - ALPH_OFFSET; sum += tmp; mx = tmp > mx ? tmp : mx; } if( mx == 0 ) { puts("2"); return 0; } for( int i = mx; i < 36; i++ ) if( !(sum%i) ) { printf( "%d\n", i+1 ); return 0; } puts( "No solution." ); return 0; }