S = input() T = S.count('t') R = S.count('r') E = S.count('e') print(min(T, R, E//2))