1768. Merge Strings Alternately
class Solution:
def mergeAlternately(self, word1: str, word2: str) -> str:
merged_string = ""
for c1, c2 in zip(word1, word2):
merged_string += c1 + c2
if len(word1) > len(word2):
return merged_string + word1[len(word2):]
elif len(word1) < len(word2):
return merged_string + word2[len(word1):]
return merged_string