#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.length(), cur = 1, best = 1;
  s += s;
  for (size_t i = 1; i < s.size(); i++)
    if (s[i] != s[i - 1])
      cur++;
    else {
      best = max(best, cur);
      cur = 1;
    }
  best = max(best, cur);
  cout << min(n, best);
  return 0;
}
