def main(): S = input() t = S.count('t') r = S.count('r') e = S.count('e') ans = min(t, r, e // 2) print(ans) main()