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