#include #include #include using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int tree[3] = { 0 }; //tree[0] := t tree[1] := r tree[2] := e int ans = 0; string S; cin >> S; int len = S.length(); for (int i = 0; i < len; i++) { if (S[i] == 't') { tree[0]++; } if (S[i] == 'r') { tree[1]++; } if (S[i] == 'e') { tree[2]++; } } int x = min(tree[0], tree[1]); if (tree[2] <= 2 * x) { ans = tree[2] / 2; } else { ans = x; } cout << ans << endl; return 0; }