Karan and Strings

3

13 votes
Basic Programming, Open, Approved, Easy
Problem

After the Tatvik Hiring Challenge, Karan's NLP professor has given him another homework. Since Manhattan Associates Hiring Challenge is round the corner and Karan is busy preparing for it, he turns to you for help.

Given a string, replace all the consecutively occurring characters by a single, same character.

Input:

The first line contains the number of test cases T. Each test case contains the string, on a separate line.

Output:

Print the modified string, each on a new line.

Constraints:

1 <= T <= 100

1 <= length(string) < 10^6

Sample Input
1
aabbcc
Sample Output
abc
Time Limit: 5
Memory Limit: 256
Source Limit:
Contributers:
Editor Image

?