import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String s = sc.nextLine(); StringBuilder sb = new StringBuilder(s); sb.append(s);//把原字符串加倍 int r = 1; for(int i = 0; i < sb.length() - 1; ++i){ int res = 1; for(int j = i; j < sb.length() - 1; ++j){//字符a与w的和为217 if(sb.charAt(j) + sb.charAt(j + 1) == 217) res++; else break; } if(r < res) r = res; } if(r > s.length()) r = s.length();//原串全部黑白相间,且首尾相异 System.out.println(r); } }