import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String S = scan.next(); scan.close(); int l = S.length(); char[]c1 = new char[l]; char[]c2 = new char[l]; for(int i = 0; i < l; i++) { c1[i] = S.charAt(i); c2[i] = S.charAt(l - i - 1); } int max = 0; for(int i = 0; i < l; i++) { int cnt = 0; for(int j = i; j < l; j++) { if(c1[j] == c2[j - i]) { cnt++; } } max = Math.max(max, cnt); } for(int i = 0; i < l; i++) { int cnt = 0; for(int j = i; j < l; j++) { if(c2[j] == c1[j - i]) { cnt++; } } max = Math.max(max, cnt); } System.out.println(max); } }