// yukicoder: No.436 ccw // 2019.4.17 bal4u #include #if 1 #define gc() getchar_unlocked() #define pc(c) putchar_unlocked(c) #else #define gc() getchar() #define pc(c) putchar(c) #endif int ins(char *s) { char *p = s; do *s = gc(); while (*s++ > ' '); *--s = 0; return s - p; } char S[100005], *p = S; int main() { int k, w, min; w = ins(S); while (*p == 'c') p++; if ((k = p-S) == 1) puts("0"); else { min = w - k; if (k-1 < min) min = k-1; } printf("%d\n", min); return 0; }