import std.stdio, std.algorithm, std.array, std.string, std.math, std.conv;

void main() {
  string s = readln.chomp;
  auto cur = s.length / 2;
  char pi = s[cur];

  if (s.length % 2 == 0) {
    while (cur < s.length && pi == s[$ - cur - 1] && pi == s[cur]) {
      ++cur;
    }
  } else {
    ++cur;
    while (cur < s.length && pi == s[$ - cur - 1] && pi == s[cur]) {
      ++cur;
    }
  }
  writeln(cur);
}
