import re def main(): line = input() match0 = re.search(r'cw(.*?)w', line) match1 = re.search(r'c(.*?)w(.*?)w', line) if match0: print(len(match0.group(0))) elif match1: print(len(match1.group(0))) else: print(-1) if __name__ == '__main__': main()