Under construction

Still being built. Things may change

Sticky Keys

Time limit1sMemory limit1024 MB

Summary
Given a line of letters, digits, and spaces, collapse each run of identical consecutive characters into a single character and print the result.
Level

Easy1 of 10

Topics
String, Implementation
Solved
No attempts yet

Problem

Bob is texting Alice about his favourite programming problems, but he spilled coffee on his keyboard and now the keys get stuck when he types. The other day, he tried to tell her about the upcoming contest "UAPC", but he accidentally sent "UAAAAAPC" because his A key got stuck. Bob is an undergraduate and cannot afford a new keyboard, so he asked you to write a program that corrects his messages.

Bob has agreed to avoid messages with adjacent copies of the same letter (for example, he will not write about the "coffee" incident). So you should always reduce runs of repeated characters down to a single character.

Input

The input is a string SS, where 1≤∣S∣≤10001 \le |S| \le 1000, which is Bob's entire message to Alice. The message may contain several space-separated words, and the whole string, including spaces, is part of the message.

SS contains only upper and lower-case letters, digits, and spaces. The coffee did not reach the spacebar, so there are never two spaces in a row.

Output

Output the message with each run of repeated consecutive characters trimmed to a single character.

Examples2

  1. Example 1

    Input
    UAAAAAPC
    
    Expected output
    UAPC
    
  2. Example 2

    Input
    UUAAPPCCC is my 11th faavvorite conNtEest
    
    Expected output
    UAPC is my 1th favorite conNtEest