#include <bits/stdc++.h>
using namespace std;
int MAX = 1000000;
int MIN = -1000000;
int INF = 1000000000;
int x4[4] = {0, 1, 0, -1};
int y4[4] = {1, 0, -1, 0};
int x8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int y8[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int i, j, k;
int main() {
  string str, tabel = "", temp;
  vector<string> v;
  while (cin >> str) {
    tabel = tabel + str;
  }
  for (i = (0); i < (tabel.size()); i++) {
    if (tabel[i] == '<') continue;
    if (tabel[i] == '>') {
      v.push_back(temp);
      temp.clear();
    } else
      temp.push_back(tabel[i]);
  }
  int indx = 0, row[100000], coll[100000];
  vector<int> hahaha;
  memset((coll), (0), sizeof(coll));
  ;
  memset((row), (0), sizeof(row));
  ;
  for (i = (0); i < (v.size()); i++) {
    if (v[i] == "table") indx++;
    if (v[i] == "tr") row[indx]++;
    if (v[i] == "td") coll[indx]++;
    if (v[i] == "/table") {
      hahaha.push_back(max(row[indx], coll[indx]));
      row[indx] = 0;
      coll[indx] = 0;
      indx--;
    }
  }
  sort(hahaha.begin(), hahaha.end());
  for (i = (0); i < (hahaha.size()); i++) {
    cout << hahaha[i];
    if (i != hahaha.size() - 1)
      cout << " ";
    else
      cout << endl;
  }
  {
    fflush(stdin);
    getchar();
  };
  return 0;
}
