#include #include using namespace std; using ll = long long; int main() { string s; cin >> s; ll numt =0; ll numr = 0; ll nume = 0; for(const char c : s){ if(c == 't'){ numt++; } else if (c == 'r'){ numr++; } else if (c == 'e'){ nume++; } } if(numt == 0 or numr == 0 or nume <= 1){ cout << 0 << endl; } else { cout << numt*numr*nume*(nume-1)/2 << endl; } return 0; }