#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int o, i, j = 1, j1 = 1, j2 = 0, j3, k, h = 1;
  string s;
  cin >> s;
  for (i = 1; i < s.length(); ++i) {
    if (j1 < h) j1 = h;
    if (h == s.length()) break;
    if (s[i - 1] != s[i] && i != 0)
      h++;
    else if (i == 0 && s[i] != s[s.length() - 1])
      h++;
    else
      h = 1;
    if (i == s.length() - 1 && j2 == 0) {
      i = -1;
      j2 = 1;
    }
  }
  if (j1 < h) j1 = h;
  cout << j1 << endl;
  return 0;
}
