using System; public class Program { public static void Main() { //int num = int.Parse(Console.ReadLine() ?? string.Empty); //string[] num = (Console.ReadLine() ?? string.Empty).Trim().Split(' '); string str = Console.ReadLine() ?? string.Empty; int t = 0; int r = 0; int e = 0; foreach (char c in str) { if(c == 't') { t++; } if(c == 'r') { r++; } if(c == 'e') { e++; } } int count = 0; //while (t > 0 && r > 0 && e >= 2) //{ // if(t >= 1 && r >= 1 && e >= 2) // { // count++; // t--; // r--; // e-=2; // } //} if(t >= 1 && r >= 1 && e >= 2) { int ee = e / 2; if(t > r) { if(r > ee) { count = ee; } else { count = r; } } else { if(t > ee) { count = ee; } else { count = t; } } } Console.WriteLine(count); } }