#include <bits/stdc++.h>
using namespace std;
int ans[1000];
int main() {
  string s, a("<table>"), a1("</table>"), b("<tr>"), b1("</tr>"), c("<td>"),
      c1("</td>"), last;
  string aa("{"), aa1("}"), bb("["), bb1("]"), cc("("), cc1(")");
  stack<char> st;
  string t;
  char ch[5000];
  while (cin >> s && s != "\0") {
    t += s;
  }
  string::size_type pos = 0;
  while ((pos = t.find(a, pos)) != string::npos) {
    t.replace(pos, a.size(), aa);
    pos++;
  }
  pos = 0;
  while ((pos = t.find(a1, pos)) != string::npos) {
    t.replace(pos, a1.size(), aa1);
    pos++;
  }
  pos = 0;
  while ((pos = t.find(b, pos)) != string::npos) {
    t.replace(pos, b.size(), bb);
    pos++;
  }
  pos = 0;
  while ((pos = t.find(b1, pos)) != string::npos) {
    t.replace(pos, b1.size(), bb1);
    pos++;
  }
  pos = 0;
  while ((pos = t.find(c, pos)) != string::npos) {
    t.replace(pos, c.size(), cc);
    pos++;
  }
  pos = 0;
  while ((pos = t.find(c1, pos)) != string::npos) {
    t.replace(pos, c1.size(), cc1);
    pos++;
  }
  int cnt = 0;
  for (int i = 0; i < t.size(); i++) {
    st.push(t[i]);
    if (t[i] == '}') {
      while (st.top() != '{') {
        st.pop();
        if (st.top() == '(') ans[cnt]++;
      }
      cnt++;
      st.pop();
    }
  }
  sort(ans, ans + cnt);
  for (int i = 0; i < cnt; i++) cout << ans[i] << " ";
  return 0;
}
