#include <bits/stdc++.h>
using namespace std;
int main() {
  string sh;
  int n;
  int i;
  int ans = 0, num = 1;
  cin >> sh;
  n = sh.length();
  sh = sh + sh;
  for (i = 1; i < 2 * n; i++) {
    if (sh[i] != sh[i - 1])
      num++;
    else
      num = 1;
    ans = max(ans, num);
  }
  if (ans > n) ans = n;
  cout << ans;
}
