import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class No00000279_Main { 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; } cnt[2] /= 2; Arrays.sort(cnt); System.out.println(cnt[0]); } }