#include <bits/stdc++.h>
using namespace std;
string str;
int main() {
  cin >> str;
  int num = 1, ans1 = 0;
  for (int i = 0; i < str.size() - 1; i++) {
    if (str[i] != str[i + 1])
      num++;
    else {
      ans1 = max(num, ans1);
      num = 1;
    }
  }
  if (num == str.size()) {
    cout << str.size() << endl;
    return 0;
  }
  str += str;
  num = 1;
  int ans = 0;
  for (int i = 0; i < str.size() - 1; i++) {
    if (str[i] != str[i + 1])
      num++;
    else {
      ans = max(num, ans);
      num = 1;
    }
  }
  cout << ans << endl;
  return 0;
}
