#include <bits/stdc++.h>
using namespace std;
string ss[15];
string s;
vector<int> ans;
int len;
bool cmp(int x, int y) { return x < y; }
bool cp(int x, char ch[]) {
  int l = strlen(ch), i;
  if (x + l > len) return false;
  for (i = 0; i < l; i++)
    if (s[x + i] != ch[i]) return false;
  return true;
}
int cl(int x) {
  int i, n = 0;
  x += 7;
  while (!cp(x, "</table>")) {
    if (cp(x, "<table>")) {
      x = cl(x);
    }
    if (cp(x, "<tr>")) x += 4;
    if (cp(x, "<td>")) {
      x += 4;
      n++;
    }
    if (cp(x, "</tr>")) x += 5;
    if (cp(x, "</td>")) x += 5;
  }
  x += 8;
  ans.push_back(n);
  return x;
}
int main() {
  int i, j, k, n = 0;
  ans.clear();
  while (cin >> ss[n]) {
    n++;
  }
  s = "";
  for (i = 0; i < n; i++) {
    s += ss[i];
  }
  len = s.size();
  cl(0);
  sort(ans.begin(), ans.end(), cmp);
  for (i = 0; i < ans.size(); i++) {
    if (i > 0) printf(" ");
    printf("%d", ans[i]);
  }
  printf("\n");
  return 0;
}
