Holi Balloons
Easy Accuracy: 51.31% Submissions: 458 Points: 2

Golu is celebrating holi by throwing water balloons from his balcony at passers-by.This gives him joy and happiness ,but, throwing balloons of same colours more than twice in a row annoys him.Given the initial throwing sequence of balloons , modify the sequence so that Golu don't have to throw balloons of same colours more than twice in a row by eliminating some balloons.Balloons colours are represented by english alphabets -{A-Z}.

Input:

First line of input contains a single integer T denoting the number of test cases. Each test case contains a string S of length N denoting the sequence of N balloons throw.
Output:

For each test case, print the modified sequence in a new line.
Constraints:

  • 1 <= T <= 100
  • 1 <= N <= 10000

Example:

Input:

3
ABBBCCDEAB

HELLO

GEEKFORRRRGEEEK

Output:

ABBCCDEAB

HELLO

GEEKFORRGEEK

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.