def solve(): s = input() idx = s.index("cw") idx2 = len(s) - idx - 1 print(min(idx, idx2)) if __name__=="__main__": solve()