S = input() T = 0 R = 0 E = 0 tree = 0 for s in S: if (s == 't'): T += 1 elif (s == 'r'): R += 1 elif (s == 'e'): E += 1 if (T >= 1 and R >= 1 and E >= 2): tree += 1 T -= 1 R -= 1 E -= 2 print(tree)