import re s,matcher=input(),"c.*w.*w" matches=re.findall(matcher,s) matches.sort(key=lambda x:len(x)) print(len(matches[0]))