#892
Silver IV
LEKTIRA
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Mario is making up silly games again instead of reading Dostoevsky for school. The rules of his newest game follow. First he chooses a random word from the book. Then he splits the word in two arbitrary places to get three separate words. After that he reverses the order of the letters in each of those three words (exchanges the first and last letters, the second and second last and so on). Finally, he puts the three words back together in the same order in which they were before splitting. The goal of the game is to obtain the lexicographically smallest word possible. In other words, of all words that can be obtained by the above procedure, find one which would be earliest in a dictionary. Write a program that plays Mario's game perfectly.

입력

The first and only line of input contains Mario's chosen word, a string of lowercase letters of the English alphabet with no spaces. The input word will be between 3 and 50 characters long (inclusive).

출력

Output the best word on a single line.

예제 입력 1

dcbagfekjih

예제 출력 1

abcdefghijk

예제 입력 2

mobitel

예제 출력 2

bometil

예제 입력 3

anakonda

예제 출력 3

aanadnok
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Silver IV1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.