import re;s=input();print(l[-1]if(l:=[r.end()for i in range(len(s))if(r:=re.match("c.*w.*w",s[i:]))])else-1)