# -*- coding: utf-8 -*- S = raw_input() tree = [0] * 3 for i in S: if i == 't': tree[0] += 1 elif i == 'e': tree[1] += 1 elif i == 'r': tree[2] += 1 tree[1] /= 2 print min(tree)