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