import collections c=collections.Counter(input()) print(min(c['t'], c['r'], c['e']//2))