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