import java.util.Scanner; import java.util.Arrays; public class Exercise55{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); String str = sc.next(); char[] strArray = str.toCharArray(); int tCount = 0; int rCount = 0; int eeCount = 0; for(int i = 0; i < strArray.length; i++){ if (strArray[i] == 't'){ tCount++; }else if (strArray[i] == 'r'){ rCount++; }else if (strArray[i] == 'e'){ eeCount++; } } eeCount /= 2; int min = Math.min(tCount, Math.min(rCount, eeCount)); System.out.println(min); } }