import sys # S = input() S = "wachiwachi" cpos = [i for i, x in enumerate(S) if x == "c"] wpos = [i for i, x in enumerate(S) if x == "w"] ans = -1 if len(cpos) == 0 or len(wpos) <= 1: print(-1) sys.exit() for i in cpos: wpostemp = [j for j in wpos if j > i] if len(wpostemp) <= 1: break if ans < wpostemp[1] - i + 1: ans = wpostemp[1] - i + 1 print(ans)