Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/stack-juftlarni-yoqotish

Removing adjacent pairs

Easy 1000 ms 128 MB 33%
Share

A string $s$ of lowercase Latin letters is given. If two equal letters stand next to each other, both are deleted and the remaining parts of the string join together. This is repeated until no such pairs are left (for example, abbacdde leaves ce). Print the remaining string; if the string disappears completely, print -.

Letters of the string: pairs of equal adjacent letters are deleted step by step, the remaining letters are highlighted

Input

One line with the string $s$.

Output

The remaining string or -.

Note

$1 \le |s| \le 2 * 10^{5}$
$s$ consists only of lowercase Latin letters (a–z)

Examples

Input #1
abbacdde
Output #1
ce
Input #2
aabccb
Output #2
-

Sign in to submit a solution

Signing up is free and takes a minute.