~/algor $ cat problems/stack-juftlarni-yoqotish
Removing adjacent pairs
Easy
1000 ms
128 MB
33%
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 -.
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
-