S = input() T = S.count("t") R = S.count("r") E = S.count("e") EE = E//2 L = [T,R,EE] print(min(L))