s = list(input()) ans = -1 for _ in range(len(s)): b = s.pop(0) if b == 'c': cww = [] wc = 0 for i in s: cww.append(i) if i == 'w': wc += 1 if wc == 2: ans = [len(cww)+1, ans][0 < ans < len(cww)+1] print(ans)