import java.io.PrintWriter import java.lang.Math.abs import java.util.* @JvmField val INPUT = System.`in` @JvmField val OUTPUT = System.out @JvmField val cin = INPUT.bufferedReader() fun readLine(): String? = cin.readLine() fun readLn() = cin.readLine()!! @JvmField var _tokenizer: StringTokenizer = StringTokenizer("") fun read(): String { while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(cin.readLine() ?: return "", " ") return _tokenizer.nextToken() } fun readInt() = read().toInt() fun readDouble() = read().toDouble() fun readLong() = read().toLong() fun readStrings(n: Int) = List(n) { read() } fun readLines(n: Int) = List(n) { readLn() } fun readInts(n: Int) = List(n) { read().toInt() } fun readIntArray(n: Int) = IntArray(n) { read().toInt() } fun readDoubles(n: Int) = List(n) { read().toDouble() } fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() } fun readLongs(n: Int) = List(n) { read().toLong() } fun readLongArray(n: Int) = LongArray(n) { read().toLong() } @JvmField val cout = PrintWriter(OUTPUT, false) fun solve(){ var s = read() var ans = 0 var v = 0 for (i in 1..2){ for (j in 0 until s.length-4){ if(s.substring(j, j+5) == "phnom") ans++ } s = s.replace("phnom", "penh") if(s.contains("[he]".toRegex())){ ans++ s = s.replace("h", "").replace('e', 'h') } } for (c in "phn(om)+".toRegex().findAll(s)) { ans += c.value.length - 3 } if(s.contains("[he]".toRegex())) ans++ cout.println(ans) } fun main(args: Array) { solve() cout.flush() }