P6064 [CF938F] Erasing Substrings
省选
题目描述

You are given a string s, initially consisting of n lowercase Latin letters. After that, you perform k operations with it, where $$k = \left\lfloor \log_2(n) \right\rfloor$$. During i-th operation you must erase some substring of length exactly 2i - 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.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
adcbca
样例输出
aba
提示

Possible operations in examples:

  1. adcbca $$\rightarrow$$ adcba $$\rightarrow$$ aba;
  2. abacabadabacaba $$\rightarrow$$ abcabadabacaba $$\rightarrow$$ aabadabacaba $$\rightarrow$$ aabacaba.