import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import static java.lang.System.in; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String S = reader.readLine(); int T = 0; int R = 0; int E = 0; for (int i = 0; i < S.length(); i++) { char s = S.charAt(i); if (s == 't') { T += 1; } else if (s == 'r') { R += 1; } else if (s == 'e') { E += 1; } } int treeCounter = 0; while ((T > 0) && (R > 0) && (E > 1)) { T -= 1; R -= 1; E -= 2; treeCounter += 1; } System.out.println(treeCounter); } }