import re def count_length_cww(cww_str): if cww_str: return len(cww_str[0]) return -1 def extract_cww(n): cww_str = re.findall("c.*w.*w", n) return cww_str def main(): n = input() cww_str = extract_cww(n) answer = count_length_cww(cww_str) print(answer) if __name__ == "__main__": main()