A. Short Substrings

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

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 (1≤t≤10001≤t≤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 (2≤|b|≤1002≤|b|≤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.

Example

input

Copy

4
abbaac
ac
bccddaaf
zzzzzzzzzz

output

Copy

abac
ac
bcdaf
zzzzzz

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".

解题说明:水题,遍历步长为2即可。

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>

using namespace std;

int main()
{
	int T;
	scanf("%d", &T);
	while (T--)
	{
		int i, j = 1;
		char a[100] = { '\0' }, b[100];
		scanf("%s", b);
		a[0] = b[0];
		for (i = 1; i<strlen(b); i += 2)
		{
			a[j++] = b[i];
		}
		printf("%s\n", a);
	}
	return 0;
}

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值