fork download
  1. # your code goes here
  2. class Solution:
  3. def mergeAlternately(self, word1: str, word2: str) -> str:
  4. index = 0
  5. result = ""
  6. for c in range(len(word2)):
  7. if index < len(word1):
  8. result += word1[index] + word2[c]
  9. index += 1
  10. else:
  11. return result + word2[c: ]
  12.  
  13. return result + word1[index:]
  14.  
Success #stdin #stdout 0.12s 14068KB
stdin
Standard input is empty
stdout
Standard output is empty