Transform String

Asked at Jane Street · Coding Questions · Difficulty: Medium · Last asked Jul 15, 2026

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…