s = input() i1 = "" flag = 0 i2 = 0 L=0 for i in range(len(s)): if i1 == "": if s[i] == "c": i1=i else: if s[i] == "w": if flag == 1: i2 = i if L < i2-i1+1: L=i2-i1+1 flag=0 i1="" i2=0 else: flag = 1 if L==0: L=-1 print(L)