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