Merge Strings Alternately Problem

Merge Strings Alternately Problem — ExecCode Easy DSA Practice

Solve the Merge Strings Alternately problem on ExecCode. Free online easy DSA practice in Two Pointers. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given two strings word1 and word2. Your task is to compute the required answer and return the merged string. 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.

Examples

Input {"word1": "abc", "word2": "pqr"}; Output apbqcr. Input {"word1": "ab", "word2": "pqrs"}; Output apbqrs

Constraints

1 <= word1.length, word2.length <= 100 word1 and word2 consist of lowercase English letters.

Practice Merge Strings Alternately free on ExecCode. Browse DSA problems, topic map, and placement guides.