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