S = list(str(input().rstrip())) a, b, c = S.count("t"), S.count("r"), S.count("e") print(min(a, b, c // 2))