#include <bits/stdc++.h>
using namespace std;
string helper(int n, int m, int k, vector<vector<int>> &dp) {
  string res = "";
  if (k > dp[n][m]) return "";
  while (k > 0 && n > 0) {
    if (dp[n - 1][m] >= k) {
      res += "0";
      n--;
    } else {
      res += "1";
      k = k - dp[n - 1][m];
      m--;
    }
  }
  while (m > 0) {
    res += "1";
    m--;
  }
  return res;
}
int main() {
  string s, ss;
  int res = 1;
  cin >> s;
  ss = s + s;
  int tmp = 1;
  for (int i = 0; i < ss.length();) {
    int j = i + 1;
    for (; j < ss.length(); j++) {
      if (ss[j] == ss[j - 1]) {
        res = tmp > res ? tmp : res;
        tmp = 1;
        i = j;
        break;
      }
      tmp++;
    }
    if (j >= ss.length()) {
      res = tmp > res ? tmp : res;
      break;
    }
  }
  res = res > s.length() ? s.length() : res;
  cout << res << endl;
  return 0;
}
