Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

F. Erasing Substrings

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou are given a string *s*, initially consisting of *n* lowercase Latin letters. After that, you perform *k* operations with it, where . During *i*-th operation you must erase some substring of length exactly 2^{ i - 1} from *s*.

Print the lexicographically minimal string you may obtain after performing *k* such operations.

Input

The only line contains one string *s* consisting of *n* lowercase Latin letters (1 ≤ *n* ≤ 5000).

Output

Print the lexicographically minimal string you may obtain after performing *k* operations.

Examples

Input

adcbca

Output

aba

Input

abacabadabacaba

Output

aabacaba

Note

Possible operations in examples:

- adcbca adcba aba;
- abacabadabacaba abcabadabacaba aabadabacaba aabacaba.

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Aug/13/2020 00:46:39 (h2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|