package yukicoder; import java.util.Scanner; public class Yuki279 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String str = scan.next(); scan.close(); // String strArr[] = str.split(""); int t = 0; int r = 0; int e = 0; int count = 0; // for(int i = 0; i < strArr.length; i++ ) { for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 't': t += 1; break; case 'r': r += 1; break; case 'e': e += 1; break; } } while (t >= 1 && r >= 1 && e >= 2) { if (t >= 1 && r >= 1 && e >= 2) { count++; t--; r--; e -= 2; } else { break; } } System.out.println(count); } }