시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 264 110 102 50.495%

문제

독서를 싫어하는 원섭이는 책에서 단어 하나를 임의로 선택한다. 그 다음, 단어를 세 부분으로 나눈다.

세 부분으로 나눈 단어를 각각 순서를 뒤집는다. (첫 번째 글자와 마지막 글자의 위치를 바꾸고, 두 번째 위치와 뒤에서 두 번째 글자의 위치를 바꾸고... 이런 식으로 계속)

마지막으로, 이 세 단어를 나누기 전과 같은 순서로 합쳐 하나로 만든다.

원섭이는 사전순으로 가장 앞서는 단어를 만드려고 한다. 원섭이가 고른 단어가 주어졌을 때, 만들 수 있는 단어 중 가장 앞서는 단어를 출력하는 프로그램을 작성하시오.

입력

첫째 줄에 원섭이가 고른 단어가 주어진다. 고른 단어는 알파벳 소문자로 이루어져 있고, 길이는 3보다 크거나 같고, 50보다 작거나 같다.

출력

첫째 줄에 원섭이가 만들 수 있는 단어 중 사전순으로 가장 앞서는 단어를 출력한다.

예제 입력 1

dcbagfekjih

예제 출력 1

abcdefghijk
W3sicHJvYmxlbV9pZCI6IjI5OTMiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWMxMzggXHViZDgwXHViZDg0IiwiZGVzY3JpcHRpb24iOiI8cD5cdWIzYzVcdWMxMWNcdWI5N2MgXHVjMmViXHVjNWI0XHVkNTU4XHViMjk0IFx1YzZkMFx1YzEyZFx1Yzc3NFx1YjI5NCBcdWNjNDVcdWM1ZDBcdWMxMWMgXHViMmU4XHVjNWI0IFx1ZDU1OFx1YjA5OFx1Yjk3YyBcdWM3ODRcdWM3NThcdWI4NWMgXHVjMTIwXHVkMGRkXHVkNTVjXHViMmU0LiBcdWFkZjggXHViMmU0XHVjNzRjLCBcdWIyZThcdWM1YjRcdWI5N2MgXHVjMTM4IFx1YmQ4MFx1YmQ4NFx1YzczY1x1Yjg1YyBcdWIwOThcdWIyMDhcdWIyZTQuPFwvcD5cclxuXHJcbjxwPlx1YzEzOCBcdWJkODBcdWJk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