import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String input = sc.nextLine(); System.out.println(countTrees(input)); } public static int countTrees(final String input) { int tQty = 0; int rQty = 0; int eQty = 0; for(int i = 0; i < input.length(); i++) { if(input.charAt(i) == 't') { tQty++; } if(input.charAt(i) == 'r') { rQty++; } if(input.charAt(i) == 'e') { eQty++; } } eQty /= 2; int treeQty = 0; while (tQty > 0 && rQty > 0 && eQty > 0) { tQty--; rQty--; eQty--; treeQty++; } return treeQty; } }