Sicily 13460. Passwords

Source: Internet
Author: User

13460. Passwords Constraints

Time limit:1 secs, Memory limit:256 MB

Description

Mirko is an evil plotting genius and have gotten hold of a list of all possible passwords for a certain the user account. The first thing he noticed is all the passwords is of odd length. Mirko assumes that the correct password are the one which can be found in both the original and reverse order in the list. For example, if the word "Tulipan" would is the correct password, the word "napilut" has to also appear in the list. Given that both words is correct passwords, Mirko would try to use both, one at a time.

Help Mirko discover what the correct password are and output its length and central character.

Input

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 14. All characters is lowercase letters of the Chinese alphabet.

Output

The first and only line of output must contain the length of the correct password and its central letter. The solution would be unique.

Sample Input
Example 1:4lasgodpsalasal Sample 2:4kisikptqtttrptulipan
Sample Output
Example 1:3 a sample 2:5 s
Hint

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.

Problem Source

2015 The first game of every Monday

#include <iostream> #include <algorithm> #include <vector> #include <string>using namespace std ; int main () {Std::ios::sync_with_stdio (false), int n;cin >> n;vector<string> V (n), for (int i = 0; i < n; i++ CIN >> v[i];for (int i = 0; i < v.size (); i++) {string s = V[i];reverse (S.begin (), S.end ()); for (int j = 0; J & Lt V.size (); J + +) {if (s = = V[j]) {cout << v[j].size () << "" << v[j][v[j].size ()/2] << Endl;return 0;}}} return 0;}

Sicily 13460. Passwords

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.