/*
ID: fniksic001
PROG: calfflac
LANG: C++
*/

#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cctype>

using namespace std;

bool palindrome(const string &s) {
    for (string::size_type i = 0; i < s.size()/2; ++i)
	if (s[i] != s[s.size()-i-1])
	    return false;
    return true;
}

int main() {
    ifstream in("calfflac.in");
    ofstream out("calfflac.out");

    string myStr;
    getline(in, myStr, static_cast<char>(char_traits<char>::eof()));

    string stripped;
    vector<string::size_type> pos;

    for (string::size_type i = 0; i < myStr.size(); ++i)
	if (isalpha(myStr[i])) {
	    stripped.push_back(tolower(myStr[i]));
	    pos.push_back(i);
	}

    int curLen = 1, curPos = 0;
    for (int i = 1; i < stripped.size(); ++i) {
	int candidatePos = i - curLen - 1;
	if (candidatePos >= 0 && curPos == candidatePos + 1 && stripped[candidatePos] == stripped[i]) {
	    curLen += 2;
	    curPos = candidatePos;
	}
	else if (candidatePos >= 0 && palindrome(stripped.substr(candidatePos, curLen + 2))) {
	    curPos = candidatePos;
	    curLen += 2;
	}
	else if (candidatePos + 1 >= 0 && palindrome(stripped.substr(candidatePos + 1, curLen + 1))) {
	    curPos = candidatePos + 1;
	    ++curLen;
	}
	else
	    ;
    }

    string::size_type myPos = pos[curPos], myLen = pos[curPos+curLen-1] - pos[curPos] + 1;
    out << curLen << endl;
    out << myStr.substr(myPos, myLen) << endl;

    return 0;
}
