ls = list(input()) res = 0 try: place_1 = ls.index('c') + 1 place_2 = ls.index('w', place_1) + 1 place_3 = ls.index('w', place_2) + 1 print(place_3 - place_1 + 1) except ValueError: print(-1)