#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int maxLen = 0;
  bool circleCompl = false;
  for (int i = 0; !circleCompl && i < str.size(); i++) {
    int count = 0;
    int j = i + 1;
    if (j >= str.size()) {
      j -= str.size();
      circleCompl = true;
    }
    if (str[i] != str[j]) {
      map<int, bool> acc;
      acc[i] = true;
      char cur = str[i];
      char next = str[j];
      while (cur != next) {
        count++;
        cur = next;
        acc[j] = true;
        j++;
        if (j >= str.size()) {
          j -= str.size();
          circleCompl = true;
        }
        next = str[j];
        if (acc[j]) {
          break;
        }
      }
      if (count > maxLen) {
        maxLen = count;
      }
      i = j - 1;
    }
  }
  maxLen++;
  printf("%d\n", maxLen);
  return 0;
}
