#include <bits/stdc++.h>
using namespace std;
char str[5005];
vector<int> v;
string s = "";
int go_tr(int x, int &res);
int go_td(int x, int &res);
int go_table(int x, int &res);
int go_td(int x, int &res) {
  if (s.substr(x, 4) == "<td>") {
    x = x + 4;
    if (s.substr(x, 5) == "</td>") {
      res++;
      return x + 4;
    } else if (s.substr(x, 7) == "<table>") {
      int ret = 0;
      int cur = go_table(x, ret);
      v.push_back(ret);
      res++;
      return cur + 5;
    } else
      assert(0);
  } else
    return -1;
}
int go_tr(int x, int &res) {
  if (s.substr(x, 4) == "<tr>") {
    x = x + 4;
    int cur;
    while (1) {
      cur = go_td(x, res);
      if (cur == -1) break;
      x = cur + 1;
    }
    if (s.substr(x, 5) == "</tr>")
      return x + 4;
    else
      assert(0);
  }
  return -1;
}
int go_table(int x, int &res) {
  int cur;
  if (s.substr(x, 7) == "<table>") {
    int ret;
    x = x + 7;
    while (1) {
      ret = 0;
      cur = go_tr(x, ret);
      if (cur == -1) break;
      x = cur + 1;
      res += ret;
    }
    return x + 7;
  }
  assert(0);
}
int main() {
  s = "";
  while (gets(str)) {
    s += str;
  }
  v.clear();
  int res = 0;
  go_table(0, res);
  v.push_back(res);
  sort(v.begin(), v.end());
  int i;
  for (i = 0; i < (v.size()); i++) {
    if (i == 0)
      ;
    else
      printf(" ");
    printf("%d", v[i]);
  }
  printf("\n");
  return 0;
}
