import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.Scanner; import java.util.Set; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t_count = 0, r_count = 0, e_count = 0; for(final char c : sc.next().toCharArray()){ switch(c){ case 't': t_count++; break; case 'r': r_count++; break; case 'e': e_count++; break; } } System.out.println(Math.min(e_count / 2, Math.min(t_count, r_count))); } }