using System; using System.Collections.Generic; using System.Linq; using System.Numerics; static public class Program { static public void Main() { var s = Console.ReadLine(); s.ToCharArray().ValidateArray(x => 'a' <= x && x <= 'z'); readEOF(); var t = 0; var r = 0; var e = 0; foreach (var x in s) { if (x == 't') t++; else if (x == 'r') r++; else if (x == 'e') e++; } var ans = new int[] { t, r, e / 2 }; Console.WriteLine(ans.Min()); } static public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; } static void readEOF() { if (Console.In.Peek() >= 0) throw new Exception("invalid input too long input file"); } } static public class Ex { static public T Validate(this T input, Func f) { if (!f(input)) throw new Exception("invalid input"); return input; } static public T[] ValidateArray(this T[] input, Func f) { foreach (var x in input) if (!f(x)) throw new Exception("invalid input"); return input; } }