import re print min(map(len, re.findall(r'(?=(c.*w.*w))', raw_input())))