#include <bits/stdc++.h>
using namespace std;


int main()
{
	freopen ("XAUDX.inp","r",stdin);
	freopen ("XAUDX.out","w",stdout);
	string s,p;
	int a,b=0,c,d,e; 
	int f,t,max=0,z=0;
	getline (cin,s);
	p=s;
	for (int i=0; i<s.length(); i++)
	{
		a=0;
		if (static_cast <int> (s[i])==static_cast <int> (s[i+2]))
		{
			b+=1;
			while (s[i-a]==s[i+2+a])	
			{
				f=2*a+3;
				a+=1;
			}
		}
		if (f>max) {max=f; t=i-a;}
	}
	for (c=0; c<s.length(); c++)
	{
		for (e=c+1; e<=s.length(); e ++)
		if (static_cast <int> (s[c])==static_cast <int> (s[e]))
		s[e]=' ';
		if (s[c]!=' ') z++;
	}
	cout << z << endl;
	for (d=t+1; d<=t+max; d++)
	cout<<p[d];
}

