ans = -1 s = input().split('c') s.pop(0) if s: for i in s: j = list(i) if j.count('w') >= 2: del j[j.index('w')] ans = [j.index('w')+3, ans][0 < ans < j.index('w')+3] print(ans)