The problem DescriptionXYZ-26 hexadecimal number is a number with each capital letter. A, B, C ,... , X, y, and z represent 0 ~ 25 digits, the 26-digit number of an n-digit is converted into a 10-digit number. The rule is as follows:
A0a1a2a3... Each digit of An-1 represents a0a1a2a3... An-1, then the 10 hexadecimal value of the XYZ-26 number is
M = A0 * 26 ^ (n-1) + A1 * 26 ^ (n-2) +... + An-3*26 ^ 2 + an-2*26 + an-1
One day, Vivi suddenly played a romantic game. She wanted to hide in a school classroom and ask fengbing leaves to find them. Of course, she also knew that fengbing leaves were not luchi, so I found the shrimp of XYZ and the water prodigal son to help, they will write a XYZ-26 in the door of the VIVI classroom, respectively, A and B, respectively, and a password is set on the door lock. Obviously, the lock can be opened only when the password is found and the classroom can be smoothly entered. This set of passwords is called lovekey by members of XYZ. Fortunately, maple ice leaves know that lovekey is a 10 hexadecimal value and B 10 hexadecimal value and the XYZ-26 hexadecimal form. Of course, the shrimp and the water prodigal do not want to be difficult as maple ice leaves, so the number of digits of A and B will not exceed 200.
For example, the first group of test data
A = 0*26 ^ 5 + 0*26 ^ 4 + 0*26 ^ 3 + 0*26 ^ 2 + 3*26 + 7 = 85
B = 1*26 ^ 2 + 2*26 + 4 = 732
Then a + B = 817 = BFL
The input questions contain multiple groups of test data.
Each group of test data contains two XYZ-26 numbers with both values, each of which contains only uppercase letters and each number must not exceed 200 characters.
Output: The lovekey of XYZ. Each group of output occupies one row.
Sample Input
Aaaadh bcedrw uhdd aaaaa
Sample output
Bflxyzd code:# Include <iostream> # include <cstdio> # include <cstring> using namespace STD; int main () {char Q [222], W [222]; char E [222]; int A, B; int I, J, K, T; while (scanf ("% S % s", Q, W )! = EOF) {T = 0; // T is used to process data containing a (0). A cannot output memset (E, 0, sizeof (E) before it )); // simulate the large number operation. There is a hexadecimal system from the back to the front, so we need to clear a = strlen (Q); B = strlen (w); if (a> = B) {for (I = A-1, j = B-1; I> = 0; I --, j --) {If (j <0) E [I] = Q [I] + E [I]; else {e [I] = E [I] + Q [I] + W [J]-'A';} If (E [I]> 'Z ') // carry {e [I-1] = 1; E [I] = E [I]-26; if (A = B & B = 1 | I = 0) // when the first digit also needs to be carried (E [-1] cannot be called) {cout <'B'; t = 1 ;}}} else // same as {for (I = A-1, j = B-1; j> = 0; I --, J --) {if (I <0) E [J] = W [J] + E [J]; else {e [J] = E [J] + Q [I] + W [J]-'A';} If (E [J]> 'Z ') {e [J-1] = 1; E [J] = E [J]-26; if (a = B & B = 1 | j = 0) {cout <'B'; t = 1 ;}}}for (I = 0; I <strlen (E); I ++) {If (E [I] = 1) {cout <'B'; t = 1 ;} else if (E [I] = 'A' & t = 1) cout <'a '; else if (E [I] = 'A' & t = 0) continue; else {cout <E [I]; t = 1 ;}} if (t = 0) // when all input data is a, cout <'a'; cout <Endl ;}return 0 ;}