This page is still under construction.

Parts of this page are still being built. What you see may change.

Dedupe

Interview

Time limit1sMemory limit128 MB

Summary
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.

Examples2

  1. Example 1

    Input
    3
    ABBBBAACC
    AAAAA
    ABC
    
    Expected output
    ABAC
    A
    ABC
    
  2. Example 2

    Input
    1
    A
    
    Expected output
    A