(lambda s: print(min([s.count('t'),s.count('r'),s.count('e')//2])))(raw_input())