Three consecutive duplicates
Submissions: 956   Accuracy:

25.13%

  Difficulty: Easy   Marks: 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

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

Contributor: Saksham Ashtputre
Author: saksham0751


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



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

to report an issue on this page.