S = input() def change2list(S): leng = len(S) Slist = [0 for i in range(leng)] for i in range(len(Slist)): Slist[i] = S[i] return Slist change2list Slist = change2list(S) def solve(Slist): minlen = -1 for i in range(len(Slist)): if Slist[i] == "c": for j in range((i+1), len(Slist)): if Slist[j] == "w": for k in range((j+1), len(Slist)): if Slist[k] == "w": minlen = k - i + 1 return minlen solve minlen = solve(Slist) print(minlen)