#K47002. Faulty Keyboard Character Correction
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
() 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 , and the total length over all queries does not exceed .
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>