#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
string a;
void Doit(int pos) {
  string t1 = a.substr(0, pos);
  reverse(t1.begin(), t1.end());
  string t2 = a.substr(pos);
  reverse(t2.begin(), t2.end());
  a = t1 + t2;
}
int main() {
  cin >> a;
  int n = a.length();
  for (int i = 1; i < n; i++) {
    if (a[0] == a[n - 1]) break;
    if (a[i] == a[i - 1]) Doit(i);
  }
  int ans = 1, cnt = 1;
  for (int i = 1; i < n; i++) {
    if (a[i] != a[i - 1]) {
      cnt++;
    } else {
      ans = max(ans, cnt);
      cnt = 1;
    }
  }
  ans = max(ans, cnt);
  cout << ans;
}
