#K47002. Faulty Keyboard Character Correction

    ID: 28101 Type: Default 1000ms 256MiB

Faulty Keyboard Character Correction

Faulty Keyboard Character Correction

In this problem, you are given query strings that may contain repeated consecutive characters due to a faulty keyboard. Your task is to remove any immediate duplicates such that from each group of consecutive identical characters, only the first occurrence remains.

For example, the string aabbccc should be processed to abc. You will be given multiple queries to process.

Note: All formulas, if any appear, are written in LaTeX format.

inputFormat

The input begins with an integer T (1T1051 \le T \le 10^5) on a single line, representing the number of queries. Each of the following T lines contains a non-empty string s consisting of lowercase English letters. The length of each string can be up to 10510^5, and the total length over all queries does not exceed 10610^6.

outputFormat

For each query, output a single line containing the processed string in which every group of consecutive duplicate characters is replaced by a single occurrence.## sample

3
aabbccc
tttyyypppeee
qqqqq
abc

type q

</p>