#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
char s[maxn];
int main() {
  while (~scanf(" %s", s)) {
    int len = strlen(s);
    for (int i = 0; i < len; i++) s[i + len] = s[i];
    s[len * 2] = '\0';
    int t = 1;
    int ans = 0;
    for (int i = 0; i < len * 2 - 1; i++) {
      if (s[i] != s[i + 1]) {
        t++;
      } else {
        t = 1;
      }
      ans = max(ans, t);
    }
    ans = min(ans, len);
    cout << ans << endl;
  }
  return 0;
}
