A1120 | [COCI-2007_2008-contest4]#2 LEKTIRA
来源COCI
时间限制1s
内存限制128MB
通过 / 提交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.
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).
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
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted