import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(), t, r, e; int ans = s.length()/4; t = s.replaceAll("t", ""); r = s.replaceAll("r", ""); e = s.replaceAll("e", ""); ans = Math.min(ans, s.length()-t.length()); ans = Math.min(ans, s.length()-r.length()); ans = Math.min(ans, (s.length()-e.length())/2); System.out.println(ans); sc.close(); } }