package yuki_coder; import java.util.Scanner; public class No_279 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String S = sc.nextLine(); sc.close(); String[] str = new String[S.length()]; int t = 0; int r = 0; int e = 0; int tree = 0; for(int i = 1; i <=S.length(); i++){ str[i-1] = S.substring(i-1, i); } for(int i = 0; i < S.length(); i++){ if(str[i].equals("t")){ t++; } if(str[i].equals("r")){ r++; } if(str[i].equals("e")){ e++; } } if(t==r&&t==e/2){ tree = t; } System.out.println(tree); } }