BETA

Difficulty Level: Easy

Submissions: 747 Accuracy:

23.03%

Three consecutive duplicates
     

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

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Ashtputre

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.