c=s=f=0;gets.chars{|t|t==?c?c+=1:t!=?w?0:s+=-c+f+=c};p s