def main(): s = input() length_minimom = 'cww' for c in range(len(s)): if s[c] == 'c': count_cww = 0 for w in range(c+1, len(s)): count_cww += 1 if s[w] == 'w': count_cww == 2 length_minimom = min(range(len(s))) break if count_cww == 2: print(length_minimom) else: return -1 if __name__ == '__main__': main()