def main(): n = input() cww_str_list = [] for i in range(len(n)): if n[i] == "c": i += 1 for j in range(i, len(n)): if n[j] == "w": j += 1 for k in range(j, len(n)): if n[k] == "w": cww_str_list.append(n[i - 1 : k + 1]) small_cww = sorted(cww_str_list, key=len) else: continue else: continue else: continue if cww_str_list == []: print(-1) else: print(len(small_cww[0])) if __name__ == "__main__": main()