import java.util.*; import java.lang.*; import java.io.*; class Main { public static void main (String[] args) { // 入力値の読み込み Scanner sc = new Scanner(System.in); String str = sc.next(); int countt = 0; int countr = 0; int counte = 0; char t='t'; char r='r'; char e='e'; for(char x: str.toCharArray()){ if(x == t){ countt++; }else if(x == r){ countr++; }else if(x == e){ counte++; } } int min =countt; if(countt > countr){ min = countr; } if(min > counte/2){ min = counte; } System.out.println(min); } }