#C9590. Xylon to Base-10 Conversion
Xylon to Base-10 Conversion
Xylon to Base-10 Conversion
In this problem, you are given a number written in the Xylon numeral system and a set of mappings from Xylon digits to their corresponding base-10 digits. Your task is to convert the given Xylon number into its base-10 representation by replacing each digit with its mapped value.
The conversion is performed by replacing each character in the Xylon number with the corresponding value from the provided mapping and concatenating the results. For example, if the Xylon number is AB
and the mappings are A → 1
and B → 0
, the resulting base-10 conversion is 10
.
Note: All operations should follow the exact character mapping provided, and there is no arithmetic computation beyond simple string concatenation.
inputFormat
The input is provided via standard input in the following format:
- The first line contains a string
S
representing the Xylon number. - The second line contains an integer
N
, denoting the number of mappings. - The next
N
lines each contain a mapping in the format:digit value
, wheredigit
is a single character andvalue
is its corresponding base-10 digit (an integer between 0 and 9).
outputFormat
Output the base-10 conversion of the given Xylon number as a single string produced by replacing each digit with its mapped value. The result should be printed to standard output.
## sampleAB
3
A 1
B 0
C 2
10