Hdu 5264 Pog loves Szh I

Source: Internet
Author: User

Topic Connection

http://acm.hdu.edu.cn/showproblem.php?pid=5264

POG loves Szh idescription

Pog has lots of strings. And he always mixes the equal-length strings. For example, there is both strings: "ABCD" and "EFGH". After mixing, the A new string "AEBFCGDH" is coming.

However, Szh thinks it is boring, so he reverses the second string, like changing "efgh" to "HGFE". Then mix them as usual, resulting in "ahbgcfde".

Now, here comes a problem. Pog is given a string after mixing by Szh, but he wants to find the original of both strings.

Hint:in this question, it needs a-linefeed at the end of line at hack time.

Input

The first line had an integer, $T (1 \leq T \leq) $, indicating the number of cases.

Then follows T lines. Every lines has a string S, whose length was even and not more than , and only consists of lower-case Chara Cters (' a ' ~ ' Z ').

Output

For each cases, please output lines, indicating, original strings.

Sample Input

1

Aabbca

Sample Output

Abc

Aba

For example, there is both strings: "ABCD" and "EFGH". After mixing, the A new string "AEBFCGDH" is coming.

1#include <algorithm>2#include <iostream>3#include <string>4 usingstd::cin;5 usingstd::cout;6 usingStd::endl;7 usingSTD::string;8 intMain () {9 #ifdef LOCALTenFreopen ("In.txt","R", stdin); OneFreopen ("OUT.txt","w+", stdout); A #endif -Std::ios::sync_with_stdio (false); -     intT; theCIN >>T; -      while(t--) { -         strings1, S2, buf; -CIN >>buf; +          for(inti =0; Buf[i]; i++) { -             if(I &1) s2 = Buf[i] +S2; +             ElseS1 + =Buf[i]; A         } atcout << s1 << endl << S2 <<Endl; -     } -     return 0; -}
View Code

Hdu 5264 Pog loves Szh I

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.