s = input() ans = -1 lst = list(s) lenth = len(lst) for index,item in enumerate(lst): if item == "c": c = index for index,item in enumerate(lst): if item == "w" and index > c: w = index for index,item in enumerate(lst): if item == "w" and index > w: ww = index ans = ww - c print(ans)