def popchr(string, char): if not char in string: return False, string i = string.find(char) string = string[:i] + string[(i+1):] return True, string string = input() flag = True count = 0 while flag : flag, string = popchr(string, "t") if not flag: break flag, string = popchr(string, "r") if not flag: break flag, string = popchr(string, "e") if not flag: break flag, string = popchr(string, "e") if not flag: break if flag: count+=1 print(count)