s=gets.chomp.chars; t=[] t << s.count('t') t << s.count('r') t << s.count('e')/2 puts t.min