str = input() print(min(str.count("t"), str.count("r"), str.count("e")//2))