#C12346. Merge Two Strings Alternately

    ID: 41763 Type: Default 1000ms 256MiB

Merge Two Strings Alternately

Merge Two Strings Alternately

You are given two strings: one containing lowercase alphabets and the other containing uppercase alphabets. Your task is to merge these two strings by alternating their characters, starting with the lowercase string. If one string is longer than the other, simply append the remaining characters to the end of the merged string.

More formally, given two strings \( S_1 \) (lowercase) and \( S_2 \) (uppercase), construct a new string \( S \) by taking \( S_1[0] \), then \( S_2[0] \), then \( S_1[1] \), then \( S_2[1] \), and so on. If \( n = |S_1| \) and \( m = |S_2| \), and without loss of generality \( n \ge m \), then

\[ S = S_1[0] S_2[0] S_1[1] S_2[1] \ldots S_1[m-1] S_2[m-1] S_1[m] \ldots S_1[n-1] \]

Otherwise, if \( m > n \), the remaining characters of \( S_2 \) are appended.

inputFormat

The input is given via standard input (stdin) and consists of two lines. The first line contains a string composed of lowercase alphabets. The second line contains a string composed of uppercase alphabets. Both strings may be empty.

outputFormat

Output the merged string according to the described alternating pattern via standard output (stdout).## sample

abc
XYZ
aXbYcZ