Cryptographer Geralt

5

1 votes
Very-Easy
Problem

Geralt of Rivia, the white wolf, is writing a letter to Triss which contains the co-ordinates of the location where they will meet in the evening. Since, the location should be kept secret, Geralt has written these co-ordinates in a cryptic way. The rules of this cypher are simple. X and Y co-ordinates are converted into words, one for each . They only consists of capital english alphabets. Each alphabet has a value associated to it. Value of a word will be the sum of values of each it's alphabets. Value of 'A' is 1, 'B' is 2, 'C' is 4, 'D' is 8 and so forth upto 'Z' which will have value 225. Your task is to help Triss decode this cypher.

Input Format--

First line consists of t, number of test cases.

Each of next t lines contains 2 words, w1 and w2, consisting of only capital english alphabets, ie, 'A' to 'Z'.

Output Format--

Output t lines, each one containing X and Y co-ordinates of corresponding case.

Constraints--

1t100

1len(w1),len(w2)100

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

For first case, value for word "AB" is (20+21)=3 and for word "CDE" is (22+23+24)=28.

For second case, value for word "GERALT" is (26+24+217+20+211+219)=657489 and for word "RIVIA" is (217+28+221+28+20)=2228737.

For third case, value for word "YES" is (224+24+218)=17039376 and for word "NO" is (213+214)=24576.

For fourth case, value for word "ABC" is (20+21+22)=7 and for word "XYZ" is (223+224+225)=58720256.

Editor Image

?