#include [[nodiscard]] static inline constexpr std::array prepare(const std::string& S) noexcept { std::array count_of = { 0, }; for (const auto& s : S) ++count_of[s]; return count_of; } [[nodiscard]] static inline constexpr int_fast32_t solve(const std::array& count_of) noexcept { return std::min({ count_of['t'], count_of['r'], count_of['e'] / 2 }); } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); std::string S; S.reserve(1'000'000), std::cin >> S; std::cout << solve(prepare(S)) << '\n'; return 0; }