#P10462. Base Conversion

    ID: 12473 Type: Default 1000ms 256MiB

Base Conversion

Base Conversion

Write a program to convert a given number from one base to another. There are \(62\) different digits available:

\(\{ 0 \sim 9,\; A \sim Z,\; a \sim z \}\)

Hint: If you convert a number from its original base to a second base, and then perform a series of conversions that eventually brings you back to the original base, you should obtain the original number.

inputFormat

The input consists of a single line containing:

  • A string representing the number in the original base.
  • An integer representing the original base.
  • An integer representing the target base.

These are separated by spaces. The bases are in the range from 2 to 62.

outputFormat

Output the number converted into the target base using the digit set: \(\{ 0\sim 9, A\sim Z, a\sim z \}\).

sample

101 2 10
5