import re;print(len(s[0])if(s:=re.match("c[^c]*w[^w]*w",input()))else-1)