#include <bits/stdc++.h>
using namespace std;
const int max_n = 100005;
string s;
int l[max_n * 2];
int main() {
  cin >> s;
  s += s;
  int ans = 0;
  for (int i = 1; i < s.size(); i++) {
    if (s[i] != s[i - 1]) l[i] = l[i - 1] + 1;
    ans = max(ans, l[i]);
  }
  printf("%d\n", min((int)s.size() / 2, ans + 1));
  return 0;
}
