#include <bits/stdc++.h>
using namespace std;
string S, dum;
vector<int> A;
int ans[5010];
string a, b, c, d, e, f;
int cek(int x) {
  bool asd = false;
  if (x + a.size() <= S.size()) {
    for (int i = 0; i < a.size(); i++) {
      if (a[i] != S[i + x]) {
        asd = true;
        break;
      }
    }
    if (!asd) return 1;
  }
  asd = false;
  if (x + b.size() <= S.size()) {
    for (int i = 0; i < b.size(); i++) {
      if (b[i] != S[i + x]) {
        asd = true;
        break;
      }
    }
    if (!asd) return -1;
  }
  asd = false;
  if (x + c.size() <= S.size()) {
    for (int i = 0; i < c.size(); i++) {
      if (c[i] != S[i + x]) {
        asd = true;
        break;
      }
    }
    if (!asd) return 2;
  }
  asd = false;
  if (x + d.size() <= S.size()) {
    for (int i = 0; i < d.size(); i++) {
      if (d[i] != S[i + x]) {
        asd = true;
        break;
      }
    }
    if (!asd) return -2;
  }
  asd = false;
  if (x + e.size() <= S.size()) {
    for (int i = 0; i < e.size(); i++) {
      if (e[i] != S[i + x]) {
        asd = true;
        break;
      }
    }
    if (!asd) return 3;
  }
  asd = false;
  if (x + f.size() <= S.size()) {
    for (int i = 0; i < f.size(); i++) {
      if (f[i] != S[i + x]) {
        asd = true;
        break;
      }
    }
    if (!asd) return -3;
  }
  return 0;
}
int main() {
  S = "";
  a = "<table>";
  b = "</table>";
  c = "<tr>";
  d = "</tr>";
  e = "<td>";
  f = "</td>";
  while (getline(cin, dum)) S += dum;
  for (int i = 0; i < S.size(); i++) {
    int temp = cek(i);
    if (temp != 0) A.push_back(temp);
  }
  stack<int> asd, tabel;
  int cur = 0;
  for (int i = 0; i < A.size(); i++) {
    if (A[i] == 1) {
      asd.push(1);
      tabel.push(cur);
      cur++;
    }
    if (A[i] == -1) {
      if (asd.top() == 1)
        asd.pop(), tabel.pop();
      else
        printf("%d ERROR1\n", i);
    }
    if (A[i] == 2) {
      asd.push(2);
    }
    if (A[i] == -2) {
      if (asd.top() == 2)
        asd.pop();
      else
        printf("%d ERROR2\n", i);
    }
    if (A[i] == 3) {
      asd.push(3);
    }
    if (A[i] == -3) {
      if (asd.top() == 3)
        asd.pop(), ans[tabel.top()]++;
      else
        printf("%d ERROR3\n", i);
    }
  }
  sort(ans, ans + cur);
  for (int i = 0; i < cur; i++) {
    if (i != 0) printf(" ");
    printf("%d", ans[i]);
  }
  puts("");
  return 0;
}
