#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
  cin >> s;
  int len = s.length();
  int p = len;
  for (int i = 0; i < len - 1; i++) {
    s.push_back(s[i]);
  }
  len = s.length();
  int ans = 1;
  int x = 1;
  for (int i = 1; i < len; i++) {
    if (s[i] != s[i - 1])
      x++;
    else
      x = 1;
    ans = max(ans, x);
  }
  printf("%d\n", min(ans, p));
  return 0;
}
