import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int numt = 0; int numr = 0; int nume = 0; for(int i = 0; i < s.length(); i++) { if(s.charAt(i) == 't') numt++; if(s.charAt(i) == 'r') numr++; if(s.charAt(i) == 'e') nume++; } int ans = Math.min(numt, Math.min(numr, nume / 2)); System.out.println(ans); } }