#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  long long int n = s.length();
  s = s + s;
  long long int cnt = 1, max1 = 1;
  for (long long int i = 1; i < s.length() - 1; i++) {
    if (s[i] != s[i - 1]) {
      cnt++;
      if (cnt > max1) max1 = cnt;
    } else
      cnt = 1;
  }
  cout << min(max1, n);
}
