#include <bits/stdc++.h>
using namespace std;
const int Maxn = 100100;
const int INF = 0x7f7f7f7f;
const double eps = 1e-8;
const double pi = 3.1415926535897932384626433832795;
int p, len;
string s, t;
vector<int> res;
void solve() {
  int ans = 0;
  while (1) {
    string tmp;
    while (s[++p] != '>') tmp += s[p];
    p++;
    if (tmp == "td")
      ans++;
    else if (tmp == "/table") {
      res.push_back(ans);
      break;
    } else if (tmp == "table")
      solve();
  }
}
int main() {
  while (cin >> t) s += t;
  p = 7;
  len = (int)s.size();
  solve();
  sort(res.begin(), res.end());
  for (int i = 0; i < (int)res.size(); i++) cout << res[i] << " ";
  return 0;
}
