#include<iostream>
using namespace std;

string s;

int main() {
    cin >> s;
    int ans = s.length(), len = s.length();
    for(int i = 0; i < s.length() - 1; i++)
        if(s[i] != s[i + 1]) ans = min(ans, max(i + 1, len - i - 1));
    cout << ans << '\n';
    return 0;
}