#include <bits/stdc++.h>
using namespace std;
int n;
string str;
int main() {
  cin >> str;
  n = str.length();
  string str1 = str + str;
  reverse(str.begin(), str.end());
  string str2 = str + str;
  int ans = 0;
  int dp[2][2 * n];
  for (int i = 0; i < 2 * n - 1; i++) {
    dp[0][i] = 1;
    if (i > 0 && str1[i] != str1[i - 1]) {
      dp[0][i] += min(n - 1, dp[0][i - 1]);
    }
    ans = max(ans, dp[0][i]);
  }
  for (int i = 0; i < 2 * n - 1; i++) {
    dp[1][i] = 1;
    if (i > 0 && str2[i] != str2[i - 1]) {
      dp[1][i] += min(n - 1, dp[1][i - 1]);
    }
    ans = max(ans, dp[1][i]);
  }
  cout << ans << endl;
}
