s = input() t = s.count('t') r = s.count('r') e = s.count('e') c = 0 while t > 0 and r > 0 and e > 1: t -= 1 r -= 1 e -= 2 c += 1 print(c)