s=gets.chomp a=s.size r=s.rindex("ccw") l=s.index("ccw") puts r||l ? [a-2-r||a,1+l||a].min : 0