String Manipulation (Remove Adjacent A-B or C-D Pairs)

Asked at Zalando · Coding Questions · Difficulty: Medium

A string `S` consisting of the letters `A`, `B`, `C` and `D` is given. The string can be transformed either by removing a letter `A` together with an adjacent letter `B`, or by removing a letter `C` together with an adjacent letter `D`.

Loading the problem…