import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; Scanner in = new Scanner(inputStream); PrintWriter out = new PrintWriter(outputStream); codeabbey solver = new codeabbey(); solver.solve(1, in, out); out.close(); } static class codeabbey { private static int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } public void solve(int testNumber, Scanner in, PrintWriter out) { int t = 0, r = 0, e = 0; String str = in.nextLine(); // 10^6 for (char ch : str.toCharArray()) { if (ch == 't') t++; if (ch == 'r') r++; if (ch == 'e') e++; } // System.out.println("t:" + t + " ,r:" + r + " ,e:" + e); if (e < 2) { out.println(0); } else { e = e / 2; int ans = gcd(t, r); ans = gcd(ans, e); out.println(ans); } } } }