P29366 [洛谷] [COCI2007-2008#4] LEKTIRA
普及
题目描述

Problem Description

Given a string, you are asked to divide it into three segments and output each segment in reverse order, concatenated in the order of segmentation. Since there are multiple solutions, output the one with the smallest lexicographical order.

Input Format

A single line containing a string representing the string to be segmented.

Output Format

A single line containing a string representing the answer, ensuring the smallest lexicographical order.

Sample Input and Output

Sample Input #1

dcbagfekjih

Sample Output #1

abcdefghijk

Sample Input #2

mobitel

Sample Output #2

bometil

Sample Input #3

anakonda

Sample Output #3

aanadnok

Notes

Data Size and Constraints

For $100\%$ of the data, the length of the input string is guaranteed to be between $3$ and $50$.

Notes

The problem is translated from COCI2007-2008 CONTEST #4 T3 LEKTIRA.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
dcbagfekjih
样例输出
abcdefghijk