class Program { static void Main(string[] args) { string inputWord = Console.ReadLine()!; int tCount = 0; int eCount = 0; int rCount = 0; int treeCount = 0; foreach (char c in inputWord) { if (c == 't') { tCount++; } else if (c == 'e') { eCount++; } else if (c == 'r') { rCount++; } if (tCount >= 1 && eCount >= 2 && rCount >= 1) { treeCount++; tCount--; eCount -= 2; rCount--; } } Console.WriteLine(treeCount); } }