#! -*- coding utf-8 -*- s = raw_input() print min( s.count('t'), s.count('r'), s.count('e') / 2 )