import java.util.*; class No0279{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String s = sc.next(); int cnt_t = 0; int cnt_r = 0; int cnt_e = 0; int cnt = 0; for(int i = 0; i < s.length(); i++){ switch(s.charAt(i)){ case 't': cnt_t++; break; case 'r': cnt_r++; break; case 'e': cnt_e++; break; } } while(true){ if(cnt_t > 0 && cnt_r > 0 && cnt_e > 1){ cnt++; cnt_t--; cnt_r--; cnt_e -= 2; }else{ break; } } System.out.println(cnt); } }