#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main()
{ 
    string s;
    cin >> s;

    int n = s.length();

    int t = n;
    for (int i = 1; i < n; i++) {
        if (s[i] != s[i - 1]) t = min(t, max(i, n - i));
    }

    cout << t << endl;

    return 0;
}
