i=0 n=0 x=%w(c w w) gets.chars do |s| i+=1 if n > 0 if s == x[n] n+=1 break if n==3 end end puts n == 3 ? i+1 : -1