← Home
write a go solution for Description:
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 Format:
The only line contains one string s consisting of n lowercase Latin letters (1 ≤ n ≤ 5000).

Output Format:
Print the lexicographically minimal string you may obtain after performing k operations.

Note:
Possible operations in examples:

1. adcbca $$\rightarrow$$ adcba $$\rightarrow$$ aba;
2. abacabadabacaba $$\rightarrow$$ abcabadabacaba $$\rightarrow$$ aabadabacaba $$\rightarrow$$ aabacaba.. Output only the code with no comments, explanation, or additional text.