#include <bits/stdc++.h>
using namespace std;
int main() {
  string a;
  cin >> a;
  int n = a.size();
  int bs = 0;
  for (int i = 0; i < a.size() - 1; ++i)
    if (a[i] == a[i + 1]) {
      bs = i + 1;
      break;
    }
  int ans = 1;
  int tmp = 1;
  for (int i = bs; i < a.size() + bs - 1; ++i)
    if (a[i % n] == a[(i + 1) % n]) {
      tmp = 1;
    } else
      ans = max(ans, ++tmp);
  printf("%d", ans);
}
