S = input() n = len(S) for v in range(1,n + 1): if 'w' in S[0:v]: i = v - 1 break if 2 * i <= n: print(i - 1) else: print(n - i)