#308. 字符串交错合并
字符串交错合并
Interleaving Strings
Background
During a programming practice session, Congcong encountered an interesting string processing problem. He needed to merge two given strings in a specific way.
Problem Description
Given two strings, and , create a new string. The new string is formed by interleaving the first character of , the first character of , the second character of , the second character of , and so on. Any leftover characters from the longer string are appended to the end of the result.
Input Format
Input is given from standard input in the following format.
A single line containing two strings and , separated by a space.
Output Format
Output is printed to standard output in the following format.
A new string formed by interleaving and .
Sample
abc xyz
axbycz
Hi There
HTihere
xxxx There
xTxhxexre
Sample Explanation
For sample 1, string is abc and string is xyz. Interleaving them results in axbycz.
For sample 2, string is Hi and string is There. First, interleave H and T, then i and h, resulting in HTih. String is exhausted. Append the remaining ere from string to the end, finally getting HTihere.
For sample 3, string is xxxx and string is There. First, interleave x and T, x and h, x and e, x and r, resulting in xTxhxexr. String is exhausted. Append the remaining x from string to the end, finally getting xTxhxexre.
Constraints
Time limit: second. Memory limit: KiB for each test case.