Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- using namespace std;
- string reverse(string s){
- int a=s.length()+1;
- char newstring[a];
- for(int i=0; i<a; i++){
- newstring[i]=s[a-2-i];
- }
- return newstring;
- }
- int main(){
- int n;
- cin >> n;
- vector<string> a;
- for(int i=0; i<n ;i++){
- string s;
- cin >> s;
- a.push_back(s);
- }
- bool found=false;
- for(int i=0; i<n-1; i++){
- for(int j=i+1; j<n; j++){
- if(reverse(a[i])==a[j]){
- int mid=(a[i].length()-1)/2;
- cout<<a[i].length()<<" "<<a[i][mid];
- found=true;
- break;
- }
- }
- if(found) break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement