#K82522. Smallest Lexicographical String
Smallest Lexicographical String
Smallest Lexicographical String
Given a string s consisting of lowercase English letters, you are allowed to perform the following operation any number of times:
- Select any contiguous substring of s with even length (i.e. its length ℓ satisfies \( \ell\ \%\ 2 = 0 \)), and reverse it.
Your task is to determine the lexicographically smallest string that can be obtained by applying this operation repeatedly. A string a is lexicographically smaller than a string b if at the first position where they differ, the character in a comes before the corresponding character in b in the alphabet. It can be proven that the lexicographically smallest string obtainable by these operations is equivalent to the string with its characters sorted in non-decreasing order.
Input/Output Requirements: The solution should read input from standard input (stdin) and output the result to standard output (stdout).
Examples:
Input: abcd Output: abcd</p>Input: dcba Output: abcd
inputFormat
The input consists of a single line containing a string s of lowercase English letters.
outputFormat
Output a single line containing the lexicographically smallest string that can be obtained.
## sampleabcd
abcd