#include <bits/stdc++.h>
using namespace std;
int diri[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dirj[] = {0, 1, 0, -1, 1, 1, -1, -1};
int compare(double d1, double d2) {
  if (fabs(d1 - d2) < 1e-9) return 0;
  if (d1 < d2) return -1;
  return 1;
}
string gettable(int j, string a) {
  string res = "";
  int x = 1;
  for (int i = j + 1; i < a.length(); ++i) {
    if (a[i] == '(') x++;
    if (a[i] == ')') x--;
    if (x == 0) return res;
    res += a[i];
  }
  return res;
}
string getraw(int j, string a) {
  string res = "";
  int x = 1;
  for (int i = j + 1; i < a.length(); ++i) {
    if (a[i] == '[') x++;
    if (a[i] == ']') x--;
    if (x == 0) return res;
    res += a[i];
  }
  return res;
}
string getcolome(int j, string a) {
  string res = "";
  int x = 1;
  for (int i = j + 1; i < a.length(); ++i) {
    if (a[i] == '<') x++;
    if (a[i] == '>') x--;
    if (x == 0) return res;
    res += a[i];
  }
  return res;
}
int main() {
  string all, s;
  while (getline(cin, s)) {
    all += s;
  }
  string t = "<table>";
  string t1 = "</table>";
  string t2 = "<tr>";
  string t3 = "</tr>";
  string t4 = "<td>";
  string t5 = "</td>";
  string a = "";
  for (int i = 0; i < all.length(); ++i) {
    if ((i <= all.length() - t.length()) && all.substr(i, t.size()) == t) {
      a += "(";
    }
    if ((i <= all.length() - t1.length()) && all.substr(i, t1.size()) == t1) {
      a += ")";
    }
    if ((i <= all.length() - t2.length()) && all.substr(i, t2.size()) == t2) {
      a += "[";
    }
    if ((i <= all.length() - t3.length()) && all.substr(i, t3.size()) == t3) {
      a += "]";
    }
    if ((i <= all.length() - t4.length()) && all.substr(i, t4.size()) == t4) {
      a += "<";
    }
    if ((i <= all.length() - t5.length()) && all.substr(i, t5.size()) == t5) {
      a += ">";
    }
  }
  vector<string> tables;
  for (int i = 0; i < a.length(); i++) {
    if (a[i] == '(') {
      string kt = gettable(i, a);
      tables.push_back(kt);
    }
  }
  vector<vector<string> > rows(tables.size());
  for (int i = 0; i < tables.size(); ++i) {
    vector<string> kl;
    for (int j = 0; j < tables[i].length(); ++j) {
      if (tables[i][j] == '[') {
        string tz = getraw(j, tables[i]);
        kl.push_back(tz);
      }
      if (tables[i][j] == '(') {
        j += gettable(j, tables[i]).length() + 2;
      }
    }
    rows.push_back(kl);
  }
  vector<int> sizes;
  for (int i = 0; i < rows.size(); ++i) {
    int cnt = 0;
    for (int j = 0; j < rows[i].size(); ++j) {
      for (int k = 0; k < rows[i][j].length(); ++k) {
        if (rows[i][j][k] == '<') {
          cnt++;
        }
        if (rows[i][j][k] == '(') {
          string sk = gettable(k, rows[i][j]);
          k += sk.length();
        }
      }
    }
    if (cnt) sizes.push_back(cnt);
  }
  sort(sizes.begin(), sizes.end());
  for (int i = 0; i < sizes.size(); ++i) {
    cout << sizes[i] << " ";
  }
  cout << endl;
  return 0;
}
