#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  if (s[0] != s[s.size() - 1]) {
    for (int i = 0; i < s.size() - 1; i++) {
      if (s[i] == s[i + 1]) {
        string s1 = s.substr(0, i + 1), s2 = s.substr(i + 1);
        reverse((s1).begin(), (s1).end());
        reverse((s2).begin(), (s2).end());
        s1.append(s2);
        s = s1;
        break;
      }
    }
  }
  int l = 1;
  int ans = 1;
  for (int i = 0; i < s.size() - 1; i++) {
    if (s[i] != s[i + 1]) {
      l++;
    } else {
      ans = max(l, ans);
      l = 1;
    }
  }
  ans = max(ans, l);
  cout << ans;
  return 0;
}
