#C6719. Bamboo Decimal Converter
Bamboo Decimal Converter
Bamboo Decimal Converter
You are given numbers in the Bamboo Decimal System. In this system, the digits are represented by characters 'A', 'B', and 'C' which correspond to 1, 2, and 3 respectively. The digits in a bamboo number are separated by the '|' character. For example, the bamboo number A|B
corresponds to the decimal number 12 (since A maps to 1 and B maps to 2).
Your task is to convert each given bamboo number into its corresponding decimal number. The conversion is done by replacing each bamboo digit by its decimal equivalent and then concatenating the results to form a normal decimal number.
Note: The input is read from standard input (stdin) and the output should be written to standard output (stdout). For each test case, output the converted number on a new line.
For example, given the bamboo number C|A|A
, the conversion yields 311
.
inputFormat
The input begins with an integer T (1 ≤ T ≤ 100) that indicates the number of test cases. Each of the next T lines contains a bamboo number where the digits are represented by 'A', 'B', and 'C' and are separated by the '|' character.
For example:
3 A|B C|A|A B|B|C|A
outputFormat
For each test case, output the converted decimal number on a separate line.
For example:
12 311 2231## sample
3
A|B
C|A|A
B|B|C|A
12
311
2231
</p>