题目连接

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

pog loves szh I

Description

Pog has lots of strings. And he always mixes two equal-length strings. For example, there are two strings: "abcd" and "efgh". After mixing, 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 two strings.

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

Input

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

Then follows T lines. Every lines has a string S, whose length is even and not more than 100, and only consists of lower-case characters('a'~'z').

Output

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

Sample Input

1

aabbca

Sample Output

abc

aba

For example, there are two strings: "abcd" and "efgh". After mixing, a new string "aebfcgdh" is coming.

 #include<algorithm>
#include<iostream>
#include<string>
using std::cin;
using std::cout;
using std::endl;
using std::string;
int main() {
#ifdef LOCAL
freopen("in.txt", "r", stdin);
freopen("out.txt", "w+", stdout);
#endif
std::ios::sync_with_stdio(false);
int t;
cin >> t;
while (t--) {
string s1, s2, buf;
cin >> buf;
for (int i = ; buf[i]; i++) {
if (i & ) s2 = buf[i] + s2;
else s1 += buf[i];
}
cout << s1 << endl << s2 << endl;
}
return ;
}

hdu 5264 pog loves szh I的更多相关文章

  1. hdu 5264 pog loves szh I 水题

    pog loves szh I Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?p ...

  2. HDU 5264 pog loves szh I (字符串,水)

    题意:设有两个串A和B,现将B反转,再用插入的形式合成一个串.如:A:abc   B:efg:反转B先,变gfe:作插入,agbfce.现在给出一个串,要求还原出A和B. 思路:扫一遍O(n),串A在 ...

  3. hdu 5266 pog loves szh III(lca + 线段树)

    I - pog loves szh III Time Limit:6000MS     Memory Limit:131072KB     64bit IO Format:%I64d & %I ...

  4. hdu 5265 pog loves szh II

    题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5265 pog loves szh II Description Pog and Szh are pla ...

  5. hdu 5265 pog loves szh II STL

    pog loves szh II Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php? ...

  6. HDU 5266 pog loves szh III(区间LCA)

    题目链接 pog loves szh III 题意就是  求一个区间所有点的$LCA$. 我们把$1$到$n$的$DFS$序全部求出来……然后设$i$的$DFS$序为$c[i]$,$pc[i]$为$c ...

  7. HDU 5265 pog loves szh II (二分查找)

    [题目链接]click here~~ [题目大意]在给定 的数组里选两个数取模p的情况下和最大 [解题思路]: 思路见官方题解吧~~ 弱弱献上代码: Problem : 5265 ( pog love ...

  8. HDU 5266 pog loves szh III ( LCA + SegTree||RMQ )

    pog loves szh III Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Oth ...

  9. HDU 5266 pog loves szh III 线段树,lca

    Pog and Szh are playing games. Firstly Pog draw a tree on the paper. Here we define 1 as the root of ...

随机推荐

  1. PMP考试--挣值如何计算?

    如果你对项目管理.系统架构有兴趣,请加微信订阅号"softjg",加入这个PM.架构师的大家庭 假设一项工作的工期是10天,预算成本是100元:也就是每天的完成进度是10%左右:每 ...

  2. 华为OJ平台——24点游戏

    题目描述: 给出4个1-10的数字,通过加减乘除,得到数字为24就算胜利 输入: 4个1-10的数字.[数字允许重复,测试用例保证无异常数字]输出: true or false 思路:

  3. TCP/IP详解学习笔记(1)-- 概述

    1.TCP/IP的分层结构      网络协议通常分不同层次进行开发,每一层分别负责不同的同信功能.TCP/IP通常被认为是一个四层协议系统.      如图所示.       1)链路层(数据链路层 ...

  4. asp.net解决数据转换为DBNULL的问题

    if (string.IsNullOrEmpty(CookieHelper.GetCookie("DEPID", "theway").ToString()) = ...

  5. Redis 2:简单使用

    导读:上一篇博客对于Redis进行了简单的介绍,本篇博客就浅显的说一下Redis的基本操作使用.本次测试的环境是window8.1,呃,没用Linux等其他系统,就下载的window环境的安装包. 一 ...

  6. grep使用

    grep常用的使用方法 grep –rns “match_content”filename 查看匹配内容的行 find /path –name “*.h” –o –name “*.cpp” | xar ...

  7. WP8_UTF8 to GB2312转码 (url网址中带中文字符的处理)

    直接使用例如:http://www.abc.php?name=中文符 ,客户端调用,在服务端修改后,会出现乱码, 而windows phone 又不能直接支持gb2312, 经过大量分析和验证,发现 ...

  8. 10 Code Coverage Tools for C & C++

    Code coverage is a measure used in software testing that describes the degree to which the source co ...

  9. Android IOS WebRTC 音视频开发总结(四六)-- 从另一个角度看国内首届WebRTC大会

    文章主要从开发者角度谈国内首届WebRTC大会,支持原创,文章来自博客园RTC.Blacker,支持原创,转载必须说明出处,更多详见www.rtc.help. -------------------- ...

  10. shell脚本中切换用户并执行命令

    1.切换用户并执行命令 su 用户名 -c "命令" 2.切换用户并执行脚本 su 用户名 -s /bin/bash 脚本路径 3.切换用户并执行命令集su 用户名 << ...