S = input() countt = 0 countr = 0 counte = 0 for s in S: if s == 't':countt += 1 elif s == 'r':countr += 1 elif s == 'e':count += 1 print(min(countt,countr,counte // 2))