import java.util.*; import java.util.Map.Entry; import java.math.*; import java.awt.geom.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); char[] S = sc.next().toCharArray(); int T = 0; int R = 0; int E = 0; for(int i = 0; i < S.length; i++) { if(S[i] == 't') T++; if(S[i] == 'r') R++; if(S[i] == 'e') E++; } System.out.println(Math.min(Math.min(T, R), E/2)); } }