#include <bits/stdc++.h>
using namespace std;
int N;
string str;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> str;
  N = (int)(str.size());
  str += str;
  int mxl = 1;
  int cur = 1;
  for (int i = 1; i <= N * 2 - 1; i++) {
    if (str[i] != str[i - 1]) {
      cur++;
      mxl = max(mxl, cur);
    } else {
      cur = 1;
    }
  }
  cout << min(N, mxl) << '\n';
  return 0;
}
