# -*- coding:utf-8 -*- if __name__ == '__main__': sn = tuple(input()) cnt = {k: 0 for k in map(chr, range(ord('a'), ord('z') + 1))} for s in sn: cnt[s] += 1 print(min(cnt['t'], cnt['r'], cnt['e'] // 2))