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