import sys S = input() for i in range(3, len(S)+1): for j in range(0, len(S)+1-i): subs = S[j:j+i] c = subs.find("c") w = subs.find("w") if c == -1 or w == -1: continue if c > w: continue if subs.count("w") >= 2: print(i) sys.exit(0) print(-1)