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