Problem
Given two strings word1 and word2, build a new string by taking letters alternately, starting with word1: first letter of word1, first letter of word2, second of word1, and so on. If one string is longer, append the rest of it to the end.
Example 1
- Input
- word1 = "abc", word2 = "pqr"
- Output
- "apbqcr"
Example 2
- Input
- word1 = "ab", word2 = "pqrs"
- Output
- "apbqrs"
Example 3
- Input
- word1 = "abcd", word2 = "pq"
- Output
- "apbqcd"
Constraints
1 <= word1.length, word2.length <= 100Both strings contain only lowercase English letters.