s = gets.chomp tc = s.count('t') rc = s.count('r') ec = s.count('e') puts [tc, rc, ec/2].min