var st,max_num,s:ansistring;
max_len,i,k:word;
f1,f2:text;
function doixung(st:ansistring):boolean;
var i,nho:word;
begin
i:=1;nho:=length(st);
while nho>i do
begin
if st[i]=st[nho] then
begin
inc(i);dec(nho);
end
else exit(false);
end;
exit(true);
end;
begin
assign(f1,'PALIND.INP');reset(f1);
assign(f2,'PALIND.OUT');rewrite(f2);
readln(f1,st);
max_len:=0;
max_num:='';
for i:=length(st) downto 1 do
begin
k:=pos(st[i],st);
s:=copy(st,k,i-k+1);
if doixung(s)=true then
begin
if max_len<i-k+1 then
begin
max_len:=i-k+1;
max_num:=s;
end
else
if max_len=i-k+1 then
begin
if max_num<s then
max_num:=s;
end;
end;
end;
writeln(f2,max_len);
writeln(f2,max_num);
close(f1);close(f2);
end.