#include <bits/stdc++.h>
using namespace std;
const bool online_judge = true;
const long long inf = 1LL << 60;
long long toInt(string s) {
  long long res;
  stringstream ss;
  ss << s;
  ss >> res;
  return res;
}
string toString(long long n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
void run() {
  string s, tmp;
  while (cin >> tmp) {
    s += tmp;
  }
  long long n = ((long long)((s).size()));
  s += "----------";
  vector<long long> ans;
  for (long long i = 0; i < n; i++) {
    if (s.substr(i, 7) == "<table>") {
      long long a = 0;
      long long b = 0;
      for (long long j = i + 1; j < n; j++) {
        if (b == 0 && s.substr(j, 4) == "<td>") a++;
        if (s.substr(j, 7) == "<table>") b++;
        if (s.substr(j, 8) == "</table>") {
          b--;
          if (b < 0) break;
        }
      }
      ans.push_back(a);
    }
  }
  sort((ans).begin(), (ans).end());
  for (long long i = 0; i < ((long long)((ans).size())); i++)
    cout << ans[i] << " ";
  cout << endl;
}
int main(int argc, char *argv[]) {
  run();
  return 0;
}
