import std.stdio, std.conv, std.string, std.range, std.math, std.bigint, std.algorithm; void main() { auto S = readln.strip; int[char] dict; S.each!(a => dict[a]++); (min(dict['t'] * 2, dict['r'] * 2, dict['e']) / 2).writeln; }