#include <bits/stdc++.h>
using namespace std;
long long vis[200005];
long long n, ans, dns;
string s;
long long dfs(int x) {
  long long ans = 1, r = (x + 1) % n, l = (x - 1 + n) % n;
  vis[x] = 1;
  if (!vis[r] && s[r] != s[x]) {
    ans += dfs(r);
  }
  if (!vis[l] && s[l] != s[x]) ans += dfs(l);
  return ans;
}
int main() {
  while (cin >> s) {
    memset(vis, 0, sizeof(vis));
    n = s.length(), ans = 0, dns = 0;
    for (int i = 0; i < n; i++) {
      if (!vis[i]) ans = max(ans, dfs(i));
    }
    cout << ans << endl;
  }
}
