#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  string s;
  cin >> s;
  int n = s.size();
  int dp[n];
  dp[0] = 1;
  for (int i = 1; i < n; i++) {
    if (s[i] != s[i - 1]) {
      dp[i] = dp[i - 1] + 1;
    } else {
      dp[i] = 1;
    }
  }
  if (dp[n - 1] == n) {
    cout << n << "\n";
    return 0;
  }
  if (s[n - 1] == s[0]) {
    int ans = 0;
    for (int i = 0; i < n; i++) {
      ans = max(ans, dp[i]);
    }
    cout << ans << "\n";
    return 0;
  }
  dp[0] = dp[n - 1] + 1;
  int i = 0;
  while (s[i] != s[i + 1]) {
    dp[i + 1] = dp[i] + 1;
    i++;
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans = max(ans, dp[i]);
  }
  cout << ans << "\n";
}
