CF1367A.Short Substrings

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Short Substrings

Alice guesses the strings that Bob made for her.

At first, Bob came up with the secret string aa consisting of lowercase English letters. The string aa has a length of 22 or more characters. Then, from string aa he builds a new string bb and offers Alice the string bb so that she can guess the string aa.

Bob builds bb from aa as follows: he writes all the substrings of length 22 of the string aa in the order from left to right, and then joins them in the same order into the string bb.

For example, if Bob came up with the string aa="abac", then all the substrings of length 22 of the string aa are: "ab", "ba", "ac". Therefore, the string bb="abbaac".

You are given the string bb. Help Alice to guess the string aa that Bob came up with. It is guaranteed that bb was built according to the algorithm given above. It can be proved that the answer to the problem is unique.

Input

The first line contains a single positive integer tt (1t10001 \le t \le 1000) — the number of test cases in the test. Then tt test cases follow.

Each test case consists of one line in which the string bb is written, consisting of lowercase English letters (2b1002 \le |b| \le 100) — the string Bob came up with, where b|b| is the length of the string bb. It is guaranteed that bb was built according to the algorithm given above.

Output

Output tt answers to test cases. Each answer is the secret string aa, consisting of lowercase English letters, that Bob came up with.

Note

The first test case is explained in the statement.

In the second test case, Bob came up with the string aa="ac", the string aa has a length 22, so the string bb is equal to the string aa.

In the third test case, Bob came up with the string aa="bcdaf", substrings of length 22 of string aa are: "bc", "cd", "da", "af", so the string bb="bccddaaf".

Samples

4
abbaac
ac
bccddaaf
zzzzzzzzzz
abac
ac
bcdaf
zzzzzz

在线编程 IDE

建议全屏模式获得最佳体验