s = io.read() n = string.len(s) p = 0 for i = 1, n do a = string.sub(s, i, i) if(a == "w") then p = i break end end print(math.min(p - 2, n + 1 - p))