#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
string second;
int main() {
  cin >> second;
  int len = (int)second.length();
  int ans = 0;
  int cur = 0;
  char prv = '#';
  for (int i = 0; i < len; i++) {
    if (second[i] != prv) {
      cur += 1;
      prv = second[i];
      ans = max(ans, cur);
    } else {
      prv = second[i];
      cur = 1;
      ans = max(ans, cur);
    }
  }
  if (ans == len) {
    printf("%d\n", ans);
    return 0;
  }
  cur = 1;
  prv = second[0];
  for (int i = 1; i < len; i++) {
    if (second[i] != prv) {
      cur += 1;
      prv = second[i];
      ans = max(ans, cur);
    } else {
      break;
    }
  }
  prv = second[0];
  for (int i = len - 1; i >= 0; i--) {
    if (second[i] != prv) {
      cur += 1;
      prv = second[i];
      ans = max(ans, cur);
    } else {
      break;
    }
  }
  printf("%d\n", ans);
  return 0;
}
