import re m = re.search('c.*?w.*?w', raw_input()) print -1 if m is None else m.end()-m.start()+1