Under construction

Still being built. Things may change

X marks the Spot

Time limit1sMemory limit1024 MB

Summary
For each string pair, find the position of x or X in S and output the letter at that position in T, uppercased, concatenated in order.
Level

Easy2 of 10

Topics
String, Implementation
Solved
No attempts yet

Problem

Hyby, who loves puzzles, decided to set another puzzle problem this year, as he did last year.

This time the topic is Indirect Indexing, and the rules are as follows.

  1. You are given NN pairs of strings (S1,T1),(S2,T2),…,(SN,TN)(S_1,T_1), (S_2,T_2), \ldots, (S_N,T_N). For each pair, the length of SiS_i equals the length of TiT_i.
  2. Let PiP_i be the position where the letter x or X appears in SiS_i. This position is always unique.
  3. Read the PiP_i-th letter of TiT_i. However, lowercase letters must be converted to uppercase.
  4. For example, if SiS_i is Indexing and TiT_i is Indirect, the letter read is R.

Input

The first line contains the number of string pairs NN. (1≤N≤500 0001 \le N \le 500\,000)

From the second line onward, line i+1i+1 contains the pair of strings SiS_i and TiT_i, separated by a space. The total length of all input strings does not exceed 1 000 0001\,000\,000, and every string consists only of English letters (uppercase or lowercase) and digits.

Output

Print the letters read for the NN string pairs, in order, concatenated on a single line.

Examples2

  1. Example 1

    Input
    8
    Exit A1in
    Axis A0on
    Exam Star
    WKXM XHHV
    maxB pyht
    XBut Club
    ATax Keep
    ifXY doC2
    
    Expected output
    10THHCPC
    
  2. Example 2

    Input
    13
    Fix Via
    Axis Anna
    Linux Ideas
    Matrix Review
    Maximum ToExist
    Exercise Practice
    GrandPrix ProjectsI
    Extraction Assistance
    ComplexUnit Contributor
    GulfOfMexico JohnHamilton
    Approximately AfricaAndAsia
    InTheContextOf Internationals
    TextAlignCenter LakeSpringfield
    
    Expected output
    ANSWERISBLANK