#!/usr/bin/env python # -*- coding:utf-8 -*- import re def chiwawa(S): pattern = re.compile("c[^cw]*w[^cw]*w") chiwawa = pattern.search(S) if chiwawa is None: return -1 else: return len(chiwawa.group(0)) def main(): S = input() print(chiwawa(S)) if __name__ == '__main__': main()