import java.util.* fun main(args: Array) { val sc = Scanner(System.`in`) var s = sc.next() var ans = 0 while (true) { var preLen = s.length s = s.replace("phnom", "penh") val replaceCount = preLen - s.length ans += replaceCount preLen = s.length s = s.replace("h", "").replace("e", "h") if (s.length == preLen) { break } ans++ } println(ans) }