#include using namespace std; int main(void) { string s; cin >> s; int w = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == 'c') continue; w = i; break; } cout << min(w - 1, (int)s.size() - w) << endl; return 0; }