package leetcode;

/**
 * https://leetcode.com/problems/merge-strings-alternately/
 */
public class Problem1768 {
    public String mergeAlternately(String word1, String word2) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem1768 prob = new Problem1768();
        System.out.println(prob.mergeAlternately("abc", "pqr")); // "apbqcr"
        System.out.println(prob.mergeAlternately("ab", "pqrs")); // "apbqrs"
        System.out.println(prob.mergeAlternately("abcd", "pq")); // "apbqcd"
    }
}

@@ -184,132 +184,170 @@
     
-// TODO%0A        return null
+StringBuilder answer = new StringBuilder()
 ;%0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem1768 prob = new Problem1768(
+for (int i = 0; i %3C Math.min(word1.length(), word2.length()); i++) %7B%0A            answer.append(word1.charAt(i)
 );%0A 
@@ -357,230 +357,318 @@
     
+  
-System.out.println(prob.mergeAlternately(%22abc%22, %22pqr%22)); // %22apbqcr%22%0A        System.out.println(prob.mergeAlternately(%22ab%22, %22pqrs%22)); // %22apbqrs%22%0A        System.out.println(prob.mergeAlternately(%22abcd%22, %22pq%22)); // %22apbqcd%22
+  answer.append(word2.charAt(i));%0A        %7D%0A        if (word1.length() %3E word2.length()) %7B%0A            answer.append(word1.substring(word2.length()));%0A        %7D else if (word1.length() %3C word2.length()) %7B%0A            answer.append(word2.substring(word1.length()));%0A        %7D%0A        return answer.toString();
 %0A   

Solve problem 1768