Please enter your email address or userHandle.
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.
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.
Print the required output.
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.