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