IBMOA #5
New Password (Interleave Two Strings)
Estimated EasyJudge-ready
Topics (AI-labelled)Strings
Take the first character of a, the first character of b, the second character of a, the second character of b, and so on; once one string is used up, append the rest of the other string.
Input
Two lines containing a and b respectively. On this site each string has 0 to 100000 printable ASCII characters (spaces allowed, but no newlines).
Output
Output the merged string as one whole line, preserving spaces.
Example 1
Input:
hackerrank
mountain
Output:
hmaocuknetrariannk
Example 2
Input:
abc
Output:
abc
Example 3
Input:
ab
XYZ
Output:
aXbYZ
Example notes
The correct outputs are hmaocuknetrariannk; abc; and aXbYZ. A spelling error in the original site's first example has been corrected.
Editorial
Loading solution…