PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#TP0000007. Rút gọn tên Apaxia (Apaxiaaaaaaaaaaaans!)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Rút gọn tên Apaxia (Apaxiaaaaaaaaaaaans!)

Apaxiaaaaaaaaaaaans!

Source: Kattis

Version: Phuoc Hung OJ Extended

Problem Statement

Some names are written with letters repeated several times in a row, making them unnecessarily long. To shorten a name, every maximal consecutive run of identical letters must be replaced by exactly one copy of that letter.

You are given a name ss consisting of lowercase English letters. Produce its shortened form. Only adjacent equal letters are merged: if the same letter appears again after a different letter, it begins a new run and must be kept.

Input

One line contains the name ss, without spaces.

Output

Print the shortened name obtained by replacing each consecutive run of equal letters by a single letter.

Subtasks

  • Subtask 1 (20 points): 1≤∣s∣≤71\le |s|\le 7; every character is a lowercase English letter from a to z.
  • Subtask 2 (30 points): 1≤∣s∣≤701\le |s|\le 70; every character is a lowercase English letter from a to z.
  • Subtask 3 (50 points): 1≤∣s∣≤2501\le |s|\le 250; every character is a lowercase English letter from a to z.

Examples

Input

rooobert

Output

robert

Explanation

The name is rooobert. Its consecutive runs, read from left to right, are r, ooo, b, e, r, t. Replace the run ooo with one o; all other runs already have length 11. Concatenating the remaining letters gives robert, which is the output.