s = STDIN.gets ans = 0 s.scan(/phn(?:om)+/).each do |t| ans += t.length - 3 end if s.include?("phnom") then s.gsub!(/phn(?:om)+/, "penh") s.gsub!(/h/, "") s.gsub!(/e/, "h") end if s.include?("h") then ans += 1; s.gsub!(/h/, "") s.gsub!(/e/, "h") end #p ans s.scan(/phn(?:om)+/).each do |t| ans += t.length - 3 end if s.include?("phnom") then s.gsub!(/phn(?:om)+/, "penh") s.gsub!(/h/, "") s.gsub!(/e/, "h") end if s.include?("h") then ans += 1; s.gsub!(/h/, "") s.gsub!(/e/, "h") end puts ans