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