# Include <stdio. h>
Char s [20001], maxwords [2001];
Int maxlen = 0, Len;
Int right (int I)
{
If (S [I] <= 'Z') & (s [I]> = 'A ')) | (S [I] <= 'Z') & (s [I]> = 'A ')))
Return (1 );
Return (0 );
}
Int copy (INT lx, int RX)
{
Int I, J;
For (I = Lx, j = 0; I <= RX; I ++, J ++)
Maxwords [J] = s [I];
Maxwords [J] = '\ 0 ';
Return (0 );
}
Int wordcmp (int x, int y)
{
If (s [x] = s [y]) Return (1 );
If (s [x]-s [y] = 32) Return (1 );
If (s [y]-s [x] = 32) Return (1 );
Return (0 );
}
Int Huiwen (INT lx, int RX)
{
Int I, j, total;
I = Lx, j = RX;
If (I = J) Total =-1;
Else Total = 0;
While (I> = 0 & J <= Len)
{
For (; I> = 0 &&! Right (I); I --);
For (; j <= Len &&! Right (j); j ++ );
If (! Wordcmp (I, j ))
{
If (total> maxlen)
{
Maxlen = total;
J --;
For (I ++ ;! Right (I); I ++ );
I --;
Copy (I, j );
}
Return (0 );
}
Total + = 2;
If (total> maxlen)
{
Maxlen = total;
Copy (I, j );
}
I --;
J ++;
}
Return (0 );
}
Main ()
{
File * In = fopen ("calfflac. In", "R ");
File * out = fopen ("calfflac. Out", "W ");
Int I, J;
For (I = 0 ;! Feof (in); I ++)
S [I] = fgetc (in );
S [I] = '\ 0 ';
Len = strlen (s );
For (I = 0; I <Len; I ++)
{
If (right (I ))
{
Huiwen (I, I );
For (j = I-1; j>-0 &&! Right (j); j --);
If (j> = 0) Huiwen (J, I );
For (j = I + 1; j <= Len &&! Right (j); j ++ );
If (j <= Len) Huiwen (I, j );
}
}
Fprintf (Out, "% d \ n % s \ n", maxlen, maxwords );
Fclose (in );
Fclose (out );
Exit (0 );
}