import re;print(len(min(re.compile(r'c*w*w').findall(input()))))