/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	
	    public static int find(ArrayList<String> words) {
       int size = 1;
       int total = 0;
       for(String w : words) {

           for(int i = 0; i < w.length() - 1; i++) {
               int front = 1, back = 1;
               while(((i - back >= 0) && (i + front <= w.length() - 1) && (w.charAt(i + front) == w.charAt(i - back)))) {
                    size += 2;
                    back++;
                    front++;
               }
               if (size > total) {
                   total = size;
               }
               size = 1;
           }
       }
       return total;
    }


	public static void main (String[] args) throws java.lang.Exception
	{
		ArrayList l = new ArrayList();
		l.add("abba");
		System.out.println(find(l));
	}
}