import sys from collections import defaultdict try: import mydebug def dprint(*objects): print(*objects) except: def dprint(*objects, sep='', end='\n'): pass s = input() dic = defaultdict(int) for c in s: dic[c] += 1 ans = min(dic["t"], dic["e"]//2) print(ans)