s = input() r = 0 tt = s.maketrans({'h':None, 'e':'h'}) while 'h' in s or 'e' in s: r += s.count('phnom') + 1 s = s.replace('phnom', 'penh').translate(tt) print(r)