#!/usr/bin/python s = raw_input() f = s.count print min(f('t'), f('r'), f('e')/2)