import java.io.*; import java.util.*; class Main279 { public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = br.readLine(); int cntT = 0, cntR = 0, cntE = 0; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == 't') cntT++; if (c == 'r') cntR++; if (c == 'e') cntE++; } System.out.println(Math.min(Math.min(cntT, cntR), cntE / 2)); } }