"""
Exercise 1: Remove All Adjacent Duplicates In String (LeetCode 1047)

Repeatedly remove two adjacent equal letters until no more can be removed.
Use a stack of characters: if the new char equals the top, pop; else push.

  remove_duplicates("abbaca") -> "ca"
"""

def remove_duplicates(s):
    # TODO
    pass


# --- self-check: do not modify below this line ---
cases = [("abbaca", "ca"), ("azxxzy", "ay"), ("", ""), ("aa", ""), ("abc", "abc")]
ok = True
for s, want in cases:
    got = remove_duplicates(s)
    print(repr(s), "->", repr(got))
    ok = ok and got == want
print("PASS" if ok else "FAIL")
