s = list(input()) ans = -1 if 'c' in s: del s[:s.index('c')] if s.count('w') >= 2: del s[s.index('w')] ans = s.index('w') + 2 print(ans)