#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:836777216")
using namespace std;
vector<int> res;
int pos;
string s;
void go(int w = -1) {
  while (pos + 7 < s.size() && s.substr(pos, 7) == "<table>") {
    res.push_back(0);
    pos += 7;
    go(res.size() - 1);
    pos += 8;
  }
  while (pos + 4 < s.size() && s.substr(pos, 4) == "<tr>") {
    pos += 4;
    go(w);
    pos += 5;
  }
  while (pos + 4 < s.size() && s.substr(pos, 4) == "<td>") {
    pos += 4;
    go(w);
    pos += 5;
    res[w]++;
  }
}
int main() {
  string t;
  while (cin >> t) s += t;
  go();
  sort((res).begin(), (res).end());
  for (int i(0); i < (res.size()); i++) {
    if (i) printf(" ");
    printf("%d", res[i]);
  }
  puts("");
  return 0;
}
