import java.util.*; public class Run { public static void main (String arg[]) { Scanner scan = new Scanner(System.in); int ans; String N = scan.next(); String tmp; int t = 0, r = 0, e = 0; for (int i = 0; i < N.length(); i++) { tmp = N.substring(i, i+1); if (tmp.equals("t")) t++; else if (tmp.equals("r")) r++; else if (tmp.equals("e")) e++; } ans = Math.min(Math.min(t, r), e/2); System.out.println(ans); } }