Three consecutive duplicates
Easy Accuracy: 25.91% Submissions: 1123 Points: 2

Given a string, you have to remove the three consecutive duplicates from the string. If no three are consecutive then output the string as it is.

Note: Print '-1' if string is empty.

Input:
The first line consists of an integer T i.e number of test cases. The only line of each test case consists of a string s.

Output:
Print the required output.

Constraints: 
1<=T<=200
1<=|String|<=100

Example:
Input:

2
aabbbaccddddc
aabbaccddc

Output:
ccdc
aabbaccddc

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.