s = input() try: i1 = s.index('c') i2 = s[i1+1:].index('w') + i1 + 1 i3 = s[i2+1:].index('w') + i2 + 1 print(i3-i1+1) except ValueError: print('-1')