import java.util.Scanner; class Main { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); String s = in.nextLine(); in.close(); String str; int t = 0; int r = 0; int e = 0; int tree = 0; int memory = 0; for(int i=1; i<=s.length(); i++) { str = s.substring(i-1,i); if(str.equals("t")) t++; if(str.equals("r")) r++; if(str.equals("e")) e++; } memory = t; if(memory > r) memory = r; if(memory > e/2) memory = e/2; tree = memory; System.out.println(tree); } }