cntTR = 0 cntE = 0 for c in input(): if c == 't' or c == 'r': cntTR += 1 if c == 'e': cntE += 1 print(min(cntTR, cntE) // 2)