시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 222 94 87 52.096%

문제

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

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

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

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

입력

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

출력

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

예제 입력 1

dcbagfekjih

예제 출력 1

abcdefghijk

힌트

W3sicHJvYmxlbV9pZCI6IjI5OTMiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWMxMzggXHViZDgwXHViZDg0IiwiZGVzY3JpcHRpb24iOiI8cD5cdWIzYzVcdWMxMWNcdWI5N2MgXHVjMmViXHVjNWI0XHVkNTU4XHViMjk0IFx1YzZkMFx1YzEyZFx1Yzc3NFx1YjI5NCBcdWNjNDVcdWM1ZDBcdWMxMWMgXHViMmU4XHVjNWI0IFx1ZDU1OFx1YjA5OFx1Yjk3YyBcdWM3ODRcdWM3NThcdWI4NWMgXHVjMTIwXHVkMGRkXHVkNTVjXHViMmU0LiBcdWFkZjggXHViMmU0XHVjNzRjLCBcdWIyZThcdWM1YjRcdWI5N2MgXHVjMTM4IFx1YmQ4MFx1YmQ4NFx1YzczY1x1Yjg1YyBcdWIwOThcdWIyMDhcdWIyZTQuPFwvcD5cclxuXHJcbjxwPlx1YzEzOCBcdWJkODBc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uJm5ic3A7PFwvcD5cclxuXHJcbjxwPlRoZSBnb2FsIG9mIHRoZSBnYW1lIGlzIHRvIG9idGFpbiB0aGUgbGV4aWNvZ3JhcGhpY2FsbHkgc21hbGxlc3Qgd29yZCBwb3NzaWJsZS4gSW4gb3RoZXIgd29yZHMsIG9mIGFsbCB3b3JkcyB0aGF0IGNhbiBiZSBvYnRhaW5lZCBieSB0aGUgYWJvdmUgcHJvY2VkdXJlLCBmaW5kIG9uZSB3aGljaCB3b3VsZCBiZSBlYXJsaWVzdCBpbiBhIGRpY3Rpb25hcnkuJm5ic3A7PFwvcD5cclxuXHJcbjxwPldyaXRlIGEgcHJvZ3JhbSB0aGF0IHBsYXlzIE1hcmlvJiMzOTtzIGdhbWUgcGVyZmVjdGx5LiZuYnNwOzxcL3A+XHJcbiIsImlucHV0IjoiPHA+VGhlIGZpcnN0IGFuZCBvbmx5IGxpbmUgb2YgaW5wdXQgY29udGFpbnMgTWFyaW8mIzM5O3MgY2hvc2VuIHdvcmQsIGEgc3RyaW5nIG9mIGxvd2VyY2FzZSBsZXR0ZXJzIG9mIHRoZSBFbmdsaXNoIGFscGhhYmV0IHdpdGggbm8gc3BhY2VzLiZuYnNwOzxcL3A+XHJcblxyXG48cD5UaGUgaW5wdXQgd29yZCB3aWxsIGJlIGJldHdlZW4gMyBhbmQgNTAgY2hhcmFjdGVycyBsb25nIChpbmNsdXNpdmUpLiZuYnNwOzxcL3A+XHJcbiIsIm91dHB1dCI6IjxwPk91dHB1dCB0aGUgYmVzdCB3b3JkIG9uIGEgc2luZ2xlIGxpbmUuJm5ic3A7PFwvcD5cclxuXHJcbjxwPiZuYnNwOzxcL3A+XHJcbiIsImhpbnQiOiIiLCJvcmlnaW5hbCI6IjEiLCJwcm9ibGVtX2xhbmdfY29kZSI6Ilx1YzYwMVx1YzViNCJ9XQ==

출처

Contest > Croatian Open Competition in Informatics > COCI 2007/2008 > Contest #4 3번

  • 문제를 번역한 사람: baekjoon
  • 어색한 표현을 찾은 사람: cokcjswo