s = input() lst = [] for i in range (0, len(s)): if s[i] == 'c': for j in range (i+1, len(s)): if s[j] == 'w': for k in range(j+1, len(s)): if s[k] == 'w': lst.append(k-i+1) if (lst.count > 0): print (min(lst)) else : print (-1)