#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int N;
char s[MAXN];
bool opp(char a, char b) {
  return (a == 'w' && b == 'b') || (a == 'b' && b == 'w');
}
int main() {
  scanf("%s", s);
  N = strlen(s);
  int best = 0;
  int cur = 0;
  char prev = 'z';
  for (int i = 0; i < 2 * N; ++i) {
    int idx = i % N;
    if (opp(s[idx], prev)) {
      cur++;
    } else {
      cur = 1;
    }
    prev = s[idx];
    best = max(best, cur);
  }
  printf("%d\n", min(best, N));
  return 0;
}
