package variablescope_kakunin; public class main { public static void main(String[] args){ int t_pos = 0; int r_pos = 0; int e_pos = 0; int tree_cnt = 0; String input = new java.util.Scanner(System.in).nextLine(); while(t_pos <= input.length() || r_pos <= input.length() || e_pos <= input.length()){ if((t_pos = input.indexOf("t", t_pos)) == -1){ break; }else{ t_pos++; } if((r_pos = input.indexOf("r", r_pos)) == -1){ break; }else{ r_pos++; } if((e_pos = input.indexOf("e", e_pos)) == -1){ break; }else{ e_pos++; } if((e_pos = input.indexOf("e", e_pos)) == -1){ break; }else{ e_pos++; } tree_cnt++; } System.out.println(tree_cnt); } }