import collections S = input() c = collections.Counter(S) t = c[t] r = c[r] e = c[e]//2 print(min(t, r, e))