#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  ifstream from;
  const long long nmin = 1, nmax = 1000, smin = 1, smax = 5000;
  long long n, m, rt, res, i, j, k, ax;
  char ch;
  string s, st;
  if (0) from.open("test.txt");
  vector<long long> v, vr;
  s = "";
  while (cin >> ch)
    if ((ch == '<') || (ch == '>') || (ch == '/') || isalnum(ch)) s += ch;
  n = s.size();
  for (i = 0; i < n; i++) {
    ch = s[i];
    if (ch == '<')
      st = "";
    else if (ch == '>') {
      if (st == "table")
        v.push_back(0);
      else if (st == "/td")
        v.back()++;
      else if (st == "/table") {
        vr.push_back(v.back());
        v.pop_back();
      }
    } else
      st += ch;
  }
  m = vr.size();
  for (i = 0; i < m - 1; i++) {
    for (j = i + 1; j < m; j++) {
      if (vr[j] < vr[i]) {
        rt = vr[i];
        vr[i] = vr[j];
        vr[j] = rt;
      }
    }
  }
  for (i = 0; i < m - 1; i++) {
    cout << vr[i] << ' ';
  }
  if (m > 0)
    cout << vr[m - 1] << endl;
  else
    cout << 0 << endl;
  return 0;
}
