s=input();x,y=0,0 for i in s: if i=='c': x,y=0,0 elif i=='w': if y==1: print(x+1);exit() else: y+=1 x+=1 print(-1)