Files
LeetCode_tasks/solutions/lc1768.py
2026-05-23 20:29:33 +05:00

16 lines
420 B
Python

class Solution:
def mergeAlternately(self, word1: str, word2: str) -> str:
word3 = ""
j = i = 0
len1 = len(word1)
len2 = len(word2)
while j < len1 or i < len2:
if j < len1:
word3 += "".join(word1[j])
j += 1
if i < len2:
word3 += "".join(word2[i])
i += 1
return word3