s=gets.chomp a=s.size-s.index("w") b=s.rindex("c") puts [a,b].min