#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int sol = 1, temp = 1;
  for (int i = 1; i < s.length(); i++) {
    if (s[i] != s[i - 1]) {
      temp++;
    } else {
      sol = max(sol, temp);
      temp = 1;
    }
    if (i == s.length() - 1) sol = max(sol, temp);
  }
  if (sol == s.length()) {
    cout << s.length() << endl;
    return 0;
  }
  if (s[0] != s[s.length() - 1]) {
    int x = 1, y = 1;
    for (int i = 1; i < s.length(); i++) {
      if (s[i] != s[i - 1])
        x++;
      else
        break;
    }
    for (int i = s.length() - 2; i >= 0; i--) {
      if (s[i] != s[i + 1])
        y++;
      else
        break;
    }
    sol = max(sol, x + y);
  }
  cout << sol << endl;
  return 0;
}
