import math._ object Main { def main(args: Array[String]) { val sc = new java.util.Scanner(System.in) val s = sc.next val t = s count (_ == 't') val r = s count (_ == 'r') val e = s count (_ == 'e') println(min(t, min(r, e/2))) } }