  iW=$stdin.gets.chomp
  arr=[]
  until ( iT=$stdin.gets.chomp ) == "END_OF_TEXT" do
    #iT=iT.gsub(/\.$/,"").split
    arr<<iT.split
  end
  arr.flatten!.map!{|s|s.gsub(/\.$/,"").downcase}
  puts arr.select{|s|s==iW}.size
