Sorry made a mistake
line=gets.chomp
cnt = 0
line.split.each {
  |v|
  if v == 'Hi' then
     cnt +=1
  end
}
puts "#{cnt}"

-- 
Posted via http://www.ruby-forum.com/.