import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No00000279_Main2 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); int[] cnt = new int[3]; for(int i = 0; i < str.length(); i++) { if(str.charAt(i) == 't') cnt[0] += 1; if(str.charAt(i) == 'r') cnt[1] += 1; if(str.charAt(i) == 'e') cnt[2] += 1; } System.out.println(Math.min(cnt[0], Math.min(cnt[1], cnt[2]/2))); } }