using LIB; using System; using System.Linq; using System.Text; using System.Collections.Generic; class Program { static void Main(string[] args) { string s = IO.R(); int tc = s.Count(c => c == 't'); int rc = s.Count(c => c == 'r'); int ec = s.Count(c => c == 'e') / 2; IO.W(Math.Min(Math.Min(tc, rc), ec)); IO.WFLUSH(); } } namespace LIB { public class IO { private const int WMAX = 1000; private static StringBuilder S = new StringBuilder(); public static T R() { return UTIL.PARSE(R()); } public static T[] R(char s = ' ') { return R().Split(s).Select(UTIL.PARSE).ToArray(); } public static T[] R(int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = R(); } return r; } public static T[][] R(int l, char s = ' ') { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = R(s); } return r; } private static string R() { return Console.ReadLine(); } public static void W(object v, bool lf = true) { S.Append(UTIL.PARSE(v)); if (lf == true) { S.Append('\n'); } if (S.Length >= WMAX) { WFLUSH(); } } public static void WFLUSH() { Console.Write(S.ToString()); S.Clear(); } } public class UTIL { public static T PARSE(object value) { return (T)(Convert.ChangeType(value, typeof(T))); } } public class MEMO { private Dictionary R; public MEMO() { R = new Dictionary(); } public Result EXEC(Key k, Func f) { Result r; if (R.ContainsKey(k)) { r = R[k]; } else { r = f(k); R.Add(k, r); } return r; } } }