const rl = require("readline").createInterface({ input: process.stdin });

var iter = rl[Symbol.asyncIterator]();

const readline = async () => (await iter.next()).value;

void async function () {

    // Write your code here

    while(line = await readline()){

        let max=0

        for(let i=0;i<line.length;i++){

            for(let j=i+1;j<=line.length;j++){

                let substr=line.slice(i,j)

                let str=substr.slice(0,substr.length/2).split('').reverse().join('')

                max=substr.slice(-(substr.length/2)).includes(str)?Math.max(max,substr.length):max

            }

        }

        console.log(max);

    }

}()