s = str(input()) C = 0 for c in s: if c == 'c': C += 1 else: break W = len(s)-C print(min(C-1, W, W-1+C-2))