cswork / OA打开练习工作台

ZalandoOA #2

Zalando Manipulation

估计简单可在线判题

考点(AI 标注)单调栈与堆字符串

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.

输入格式

One line with a string of length 0..250000, containing only A, B, C, D.

输出格式

Output any irreducible string; for an empty result, output an empty line.

样例 1

输入:

CBACD

输出:

C

样例 2

输入:

CABABD

输出:

样例 3

输入:

ACBDACBD

输出:

ACBDACBD