print((function (s,t,r,e) s:gsub(".", function (c) if c == "t" then t = t + 1 elseif c == "r" then r = r + 1 elseif c == "e" then e = e + 1 end end) e = bit.rshift(e, 1) return math.min(t,r,e) end)(io.stdin:read("*l"),0,0,0))