# 1768. Merge String Alternaly # # You are given two strings word1 and word2. Merge the strings by adding # letters in alternating order, starting with word1. # If a string is longer than the other, append the additional letters # onto the end of the merged string. # # Return the merged string. def mergeStringsAlternately(word1: str, word2: str) -> str: merged_string: str = "" for i in range(max(len(word1), len(word2))): if (i >= len(word1)): merged_string += word2[i:] break elif (i >= len(word2)): merged_string += word1[i:] break else: merged_string += word1[i] merged_string += word2[i] return merged_string