ZalandoOA #2
Zalando Manipulation
Estimated EasyJudge-ready
Topics (AI-labelled)Stacks & HeapsStrings
The string contains only A, B, C, D. You may repeatedly delete two adjacent characters that are A/B or C/D, in either order. Output any result that cannot be reduced further.
Input
One line with a string of length 0..250000, containing only A, B, C, D.
Output
Output any irreducible string; for an empty result, output an empty line.
Example 1
Input:
CBACD
Output:
C
Example 2
Input:
CABABD
Output:
Example 3
Input:
ACBDACBD
Output:
ACBDACBD
Editorial
Loading solution…