#include <bits/stdc++.h>
using namespace std;
string s;
int ans[500];
vector<int> ac;
void dfs(int pos, int cnt) {
  if (pos == s.size() - 1) return;
  string t = s.substr(pos, 7);
  if (t == "<table>") {
    dfs(pos + 7, cnt + 1);
  }
  t = s.substr(pos, 8);
  if (t == "</table>") {
    ac.push_back(ans[cnt]);
    ans[cnt] = 0;
    dfs(pos + 8, cnt - 1);
  }
  t = s.substr(pos, 4);
  if (t == "<tr>") {
    dfs(pos + 4, cnt);
  }
  if (t == "<td>") {
    ans[cnt]++;
    dfs(pos + 4, cnt);
  }
  t = s.substr(pos, 5);
  if (t == "</td>") {
    dfs(pos + 5, cnt);
  }
  if (t == "</tr>") {
    dfs(pos + 5, cnt);
  }
}
int main() {
  string ss;
  int count = 0;
  while (getline(cin, ss) && count < 10) {
    s += ss;
    count++;
  }
  dfs(0, -1);
  sort(ac.begin(), ac.end());
  for (int i = 0; i < ac.size() - 1; i++) cout << ac[i] << ' ';
  cout << ac[ac.size() - 1] << endl;
  return 0;
}
