logo AlgoBeat OnlineJudge
登录 注册

#216231. [ICPC 2015 NAIPC] String Stretching

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Start with a string . Now, create a new string , like this: Start with the empty string, and insert . Then, choose some position in the string (including, possibly, the very beginning or the very end), and insert again. And again. And again.

For example, suppose is "hello". Starting with the empty string, a string might be generated like this (each new insertion of is in bold):

  1. hello
  2. hhelloello
  3. hhelloelhellolo
  4. hhehellolloelhellolo

So, after 5 steps, the string is hhehellolloelhellolo.

Given the final string , find the shortest string which could have generated . If there’s more than one with the shortest length, find the one that comes first alphabetically.

输入格式

Each input will consist of a single test case. Note that your program may be run multiple times on different inputs. Each input consists of a single line with a single string . The string will consist of only lower case letters, and will be at least , and at most , characters long.

输出格式

Output a single line with the string , which is the shortest possible string that could generate .

样例

样例输入 1

hhehellolloelhellolo

样例输出 1

hello