S = gets.chomp t = S.count('t') r = S.count('r') e = S.count('e') puts [t,r,e/2].min