S=input() t=S.find("w",S.find("w",S.find("c"))+1)-S.index("c")+1 if t>=3: print(t) else: print("-1")