#include <bits/stdc++.h>
using namespace std;
const int N = 100009;
int main() {
  string s;
  cin >> s;
  int l = s.size();
  for (int i = 0; i < l; i++) s += s[i];
  int ans = 1;
  for (int i = 0; i < l;) {
    int j = i;
    for (; j < l + i - 1; j++) {
      if (s[j] == s[j + 1])
        break;
      else
        ans = max(ans, j - i + 2);
    }
    i = j + 1;
  }
  cout << ans << endl;
}
