a = 0 b = float('inf') d = 0 for i, c in enumerate(raw_input()): if c == 'c': a = 1 d = i elif c == 'w': a += 1 if a == 3: b = min(b, i-d+1) print b if b != float('inf') else -1