package leetcode;

/**
 * https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string/
 */
public class Problem1047 {
    public String removeDuplicates(String S) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem1047 prob = new Problem1047();
        System.out.println(prob.removeDuplicates("abbaca")); // ca
    }
}

@@ -181,35 +181,438 @@
     
-// TODO%0A        return null
+String answer = S;%0A        int i = 0;%0A        while (i %3C answer.length() - 1) %7B%0A            if (answer.charAt(i) == answer.charAt(i + 1)) %7B%0A                answer = answer.substring(0, i) + (i + 2 %3C answer.length() ? answer.substring(i + 2) : %22%22);%0A                i--;%0A                if (i %3C 0) %7B%0A                    i = 0;%0A                %7D%0A            %7D else %7B%0A                i++;%0A            %7D%0A        %7D%0A        return answer
 ;%0A  
@@ -774,16 +774,149 @@
 ; // ca%0A
+        System.out.println(prob.removeDuplicates(%22aabbaca%22)); // aca%0A        System.out.println(prob.removeDuplicates(%22cabbac%22)); //%0A
     %7D%0A%7D%0A

Update problem 1047