S = input(); print(int(min([S.count('t'), S.count('r'), S.count('e') / 2])))