Welcome to ZOJ
Information
Select Problem
Runs
Ranklist
ZOJ Problem Set - 4023
PPAP

Time Limit: 1 Second      Memory Limit: 65536 KB

"I have a pen. I have an apple. Uh! Applepen."

"I have a pen. I have pineapple. Uh! Pineapplepen."

The above lyrics are taken from PPAP, a single by Pikotaro. It was released as a music video on YouTube on 25 August 2016, and has since become a viral video. As of October 2017, the official video has been viewed over 126 million times.

Let's view this song from a mathematical perspective. In the lyrics there actually hides a function \(\text{PPAP}(a, b)\), which takes two lowercased string \(a\) and \(b\) as the input and works as follows:

  • First, calculate \(s_1 = b + a\) (\(+\) here means string concatenation).
  • Then, capitalize the first character of \(s_1\) to get \(s_2\).
  • Make \(s_2\) as its output, and the function is done.

For example, we have PPAP("pen", "apple") = "Applepen", and PPAP("pen", "pineapple") = "Pineapplepen".

Given two lowercased strings \(a\) and \(b\), your task is to calculate \(\text{PPAP}(a, b)\).

Input

The first line of the input contains an integer \(T\) (about 100), indicating the number of test cases. For each test case:

The first and only line contains two strings \(a\) and \(b\) (\(1 \le |a|, |b| \le 30\)) separated by one space. It's guaranteed that both \(a\) and \(b\) consist of only lowercase English letters.

Output

For each test case output one line containing one string, indicating \(\text{PPAP}(a, b)\).

Sample Input

3
pen apple
pen pineapple
abc def

Sample Output

Applepen
Pineapplepen
Defabc

Author: WENG, Caizhi
Source: The 18th Zhejiang University Programming Contest Sponsored by TuSimple
Submit    Status