s=input() n=100 m=0 for i in s: m+=1 w=c=1 for j in s[m:]: c+=1 if'w'==j:w+=1 if i=='c'and w>2:n=min(n,c) print(-1if n>99else n)