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