s = input() print(min(s.count('t'), s.count('r'), s.count('e')//2))