import java.io.InputStream; import java.io.PrintWriter; import java.lang.reflect.Array; import java.math.BigDecimal; import java.math.MathContext; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.PriorityQueue; import java.util.Queue; import java.util.Scanner; import java.util.Set; import java.util.Stack; import java.util.TreeMap; import java.util.TreeSet; import static java.util.Comparator.*; public class Main { public static void main(String[] args) { PrintWriter out = new PrintWriter(System.out); Solver solver = new Solver(System.in, out); solver.solve(); out.close(); } } class Solver { Scanner sc; PrintWriter out; public Solver(InputStream in, PrintWriter out) { sc = new Scanner(in); this.out = out; } // ================================================================== public void solve() { char[] C = sc.next().toCharArray(); int ans = 0, cnt, offset; for (int i = 1; i < C.length; i++) { cnt = 0; offset = 1; while((i - offset) >= 0 && (i + offset - 1) <= (C.length - 1)) { // out.println(" i = " + i + " offset = " + offset // + " C[" + (i - offset) + "] = " + C[i - offset] // + " C[" + (i + offset - 1) + "] = " + C[i + offset - 1]); if(C[i - offset] == C[i + offset - 1]) cnt += 2; offset++; } ans = Math.max(ans, cnt); } for (int i = 1; i < C.length; i++) { cnt = 1; offset = 1; while((i - offset) >= 0 && (i + offset) <= (C.length - 1)) { // out.println(" i = " + i + " offset = " + offset // + " C[" + (i - offset) + "] = " + C[i - offset] // + " C[" + (i + offset) + "] = " + C[i + offset]); if(C[i - offset] == C[i + offset]) cnt += 2; offset++; } ans = Math.max(ans, cnt); } out.println(ans == 0 ? 1 : ans); } }