s=input() n = 0 num = -1 while num < n: num = n fi = s 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 if s == fi: n = num break print(n)