Dedupe
InterviewTime limit1sMemory limit128 MB
For each of several strings, collapse every run of consecutive identical letters into a single letter and print the result.
- Level
Easy2 of 10
- Topics
- String, Implementation
- Solved
- No attempts yet
Problem
Redundancy in this world is pointless. Let's get rid of all redundancy. For example, AAABB is redundant — why not just write AB? Given a string, collapse every run of consecutive identical letters into a single letter.
Input
The first line contains an integer, the number of data sets that follow. Each of the following lines is one data set: a single string whose length is less than 100 and that contains only uppercase letters.
Output
For each string, print the deduped string on its own line.