import re s = input() """ p = re.search(r"c.*?w+?.*?w", s) if p: print(len(p.group())) else: print(-1) """ cnt = 0 i = 0 res = [] flag_c, flag_w = False, False for i in s: if i == "c" and not flag_c: flag_c = True #elif i == "c" and flag_c: # cnt = 0 if i == "w" and flag_c and not flag_w: flag_w = True elif i == "w" and flag_c and flag_w: res.append(cnt) flag_c = False flag_w = False cnt = 0 if flag_c or flag_w: cnt += 1 if len(res) == 0: print(-1) else: max_res = max(res) print(max_res+1)