s=input() n = 0 num = -1 while num < n: num = n fd = s.find('phnom') if fd > -1: s = s.replace('phnom', 'penh', 1) n += 1 fd = s.find('h') if fd > -1: s = s.replace('h', '') s = s.replace('e', 'h') n += 1 print(n)