S = input() count_t = S.count('t') count_r = S.count('r') count_e = S.count('e') ans = min(count_t, count_r, count_e // 2) print(ans)