S = input() cPos, wPos, w2Pos, minStep, tempC, tempW = 0, 0, 0, 0, 0, 0 for _ in range(S.count("c")): if cPos==0 and wPos==0: cPos = S.find("c") tempC = cPos wPos = S.find("w", cPos+1) tempW = wPos w2Pos = S.find("w", wPos+1) if cPos == -1 or w2Pos == -1 or wPos==-1: minStep = -1 break minStep = w2Pos - cPos + 1 else: cPos = S.find("c", tempC+1) tempC = cPos wPos = S.find("w", tempW+1) w2Pos = S.find("w", wPos+1) if minStep