import re print(min([-1] + [len(i) for i in re.findall(r'c\w*w\w*w', input()) if i != []]))