#K75362. Remove Adjacent Duplicates

    ID: 34403 Type: Default 1000ms 256MiB

Remove Adjacent Duplicates

Remove Adjacent Duplicates

Problem Statement

Given a string \( s \), remove all adjacent duplicate characters repeatedly until no adjacent duplicates remain, and output the final string. The process is similar to an elimination chain reaction where pairs of identical characters cancel each other out.

For example, if \( s = \texttt{abbaca} \), the sequence of operations will eventually yield \( \texttt{ca} \).

You are required to read the input string from standard input and write the output to standard output.

inputFormat

The input consists of a single line containing a non-empty string \( s \) composed of lowercase or uppercase letters. The length of \( s \) is at least 1 and can be up to \( 10^5 \) characters.

outputFormat

Output a single string which is the result after repeatedly removing all adjacent duplicate characters from \( s \).

## sample
abbaca
ca