#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  int n = s.length();
  string t = s + s;
  int ans = 1;
  int length = 1;
  for (int i = 1; i < t.length(); i++) {
    if (t[i] != t[i - 1])
      length++;
    else
      length = 1;
    ans = max(ans, length);
  }
  cout << min(ans, n);
  return 0;
}
