#include <bits/stdc++.h>
using namespace std;
template <class RandomAccessIterator>
void Print(RandomAccessIterator first, RandomAccessIterator last,
           char endl1 = '\n', char endl2 = ' ') {
  while (first != last)
    cout << (*first++) << (last - 1 == first ? endl1 : endl2);
}
struct QuickIO {
  QuickIO() {
    const int SZ = 1 << 20;
    setvbuf(stdin, new char[SZ], _IOFBF, SZ);
    setvbuf(stdout, new char[SZ], _IOFBF, SZ);
  }
} QIO;
const int debug = 1;
const int size = 5000 + 10;
const int INF = INT_MAX >> 1;
char str[211111];
int main() {
  scanf("%s", str);
  int len = strlen(str);
  if (len == 1) {
    printf("1\n");
    return 0;
  }
  for (int i = 0; i < len; i++) {
    str[len + i] = str[i];
  }
  str[len + len] = '\0';
  int ans = 0, cnt = 0;
  for (int i = 0; i < len + len - 1; i++) {
    if (str[i] != str[i + 1]) {
      cnt++;
      ans = max(ans, cnt);
    } else
      cnt = 0;
  }
  printf("%d\n", min(len, ans + 1));
  return 0;
}
