#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(i,n) for(int i=0;i<(n);i++) #define REP(i,a,n) for(int i=a;i<(n);i++) #define rrep(i,n) for(int i=(n)-1;i>=0;i--) #define VI vector #define VS vector #define all(a) (a).begin(),(a).end() #define debug(x) cout<<#x<<": "< P; typedef long long ll; const int INF=1000000; char fi[101][101]; int d[21][21]; int day[12]={31,28,31,30,31,30,31,31,30,31,30,31}; int N,M; int sx,sy; int gx,gy; int w,h; int ans; int dx[4]={0,0,-1,1}; int dy[4]={-1,1,0,0}; const int MAX_V=100; const int MAX_N=100; char o[3]={'+','-','*'}; #define md 1000003 set a; ll po(ll x,int n){ ll r=1; while(n>0){ if(n&1) r=(r*x)%md; x=(x*x)%md; n>>=1; } return r; } int main(){ string s; cin>>s; int N=s.size(); int mx=N+1; int n1=N; int n2=n1; bool f=false; for(int i=s.size()-1;i>=0;i--){ if(s[i]=='w'){ n2=n1; n1=i; } if(s[i]=='c'&&n2!=N){ mx=min(mx,n2-i+1); } } if(mx==N+1) mx=-1; cout<