#coding: UTF-8 import sys import re import itertools from collections import deque ### defs ### def cww(s): sz = len(s) cnt=0 for c in s: if (cnt==0 and c=='c'): cnt+=1 elif (cnt==1 and c=='w'): cnt+=1 elif (cnt==2 and c=='w'): cnt+=1 if(cnt==3): res=sz else: res=-1 return res ### main ### s = sys.stdin.readline() ans = -1 sz = len(s) for i in range(sz): for j in range(i+1,sz+1): l = cww(s[i:j]) if (l > 0): if(ans < 0): ans = l else: ans = min(ans,l) print (ans)