S = input() try: c1 = S.index('c') w2 = S.index('w',c1+1) w3 = S.index('w',w2+1) print(w3 - c1 + 1) except: print(-1)