#include <bits/stdc++.h>
using namespace std;
string s;
int ans, cnt;
int main() {
  cin >> s;
  s += s;
  for (int i = 0; i < s.size(); ++i) {
    if (i && s[i] == s[i - 1])
      cnt = 1;
    else
      ++cnt;
    ans = max(ans, std::remove_reference<decltype(ans)>::type(cnt));
  }
  ans = min(ans, std::remove_reference<decltype(ans)>::type(s.size() / 2));
  printf("%d\n", ans);
}
