import re def main(): s = input() m = re.search(r"c.*?w.*?w", s) ans = 101 while m != None: ans = min(ans, len(m.group(0))) m = re.search(r"c.*?w.*?w", s[m.endpos:]) if (ans == 101): ans = -1 print(ans) main()