A combination dial displays a non-negative integer using positional notation. Digit values from 0 to 35 are written as the characters 0-9 then A-Z (so A means ten, Z means thirty-five). Given the value written in a source base and a target base, output the same value written in the target base, using uppercase letters, with no leading zeros (except the single digit 0 for the value zero).
Line 1: two integers from_base and to_base.
Line 2: the value written in from_base (uppercase letters for digit values of 10 or more).
A single line: the value written in to_base.
from_base.Example 1
Input
10 2 13
Expected
1101
Explanation
The decimal value 13 written in base 2 is 1101.
Example 2
Input
16 10 FF
Expected
255
Explanation
The hexadecimal value FF equals 255 in base 10.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →