You are given two strings, word1 and word2. Your task is to create a new string by taking characters from each string one-by-one in alternating order, beginning with word1.
If one of the strings still has characters left after the alternating process ends, simply attach the remaining characters to the end of the result.
Return the newly formed string.
Input: word1 = "hello", word2 = "zz"
Output: "hzello"
Explanation:
Merge: h z e → remaining "llo" gets added.
Input: word1 = "xy", word2 = "1234"
Output: "x1y234"
Explanation:
Take x → 1 → y → 2, then leftover "34" is appended.
Input: word1 = "a", word2 = "b"
Output: "ab"
Accepted:
Submission: