A1307 | [COCI-2013_2014-contest5]#4 LOZINKA
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Mirko is an evil plotting genius and has gotten hold of a list of all possible passwords for a certain user account. The first thing he noticed was all the passwords are of odd length. Mirko assumes that the correct password is the one which can be found in both the original and reverse order in the list. For example, if the word “tulipan” would be the correct password, the word “napilut” has to also appear in the list. Given that both words are correct passwords, Mirko will try to use both, one at a time.
Help Mirko discover what the correct password is and output its length and central character.
Help Mirko discover what the correct password is and output its length and central character.
输入格式
The first line of input contains the integer N (1 ≤ N ≤ 100), the number of possible passwords.
Each of the following N lines contains a single word, its length being an odd number greater than 2 and lesser than 1
4. All characters are lowercase letters of the English alphabet.
Each of the following N lines contains a single word, its length being an odd number greater than 2 and lesser than 1
4. All characters are lowercase letters of the English alphabet.
输出格式
The first and only line of output must contain the length of the correct password and its central letter.
The solution will be unique.
The solution will be unique.
输入输出样例
输入 #1
4 las god psala sal
输出 #1
3 a
输入 #2
4 kisik ptq tttrp tulipan
输出 #2
5 s
Clarification of the first example: The required pair of words is “las” and “sal”. Their length is 3
letters and the central character is 'a'.
Clarification of the second example: The word “kisik” can be found in both the original and reverse
order on the list (the word is a palindrome), so it is a valid correct password.
letters and the central character is 'a'.
Clarification of the second example: The word “kisik” can be found in both the original and reverse
order on the list (the word is a palindrome), so it is a valid correct password.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted