from collections import * S = Counter(input()) print(min(S["t"], S["r"], S["e"]//2))