s=raw_input() if s=="ccw": print("0") exit() print(str(min(s.count("c")-1,s.count("w"))))