#include <bits/stdc++.h>
using namespace std;
const bool DEBUG = false;
string s = "";
vector<int> ans;
int cp = 0;
int maxd = 0;
int cnt;
string next_tag() {
  if (cp >= s.size()) return "";
  string ret = "<";
  cp++;
  while (s[cp] != '>') ret += s[cp++];
  cp++;
  ret += '>';
  if (DEBUG) cerr << ret << endl;
  return ret;
}
void solve() {
  if (DEBUG) cerr << "enter solve()\n";
  ans.push_back(0);
  int cp = ans.size() - 1;
  string ctag;
  while ((ctag = next_tag()) != "</table>") {
    if (ctag == "<td>") {
      if (DEBUG) cerr << "Inc: ctag = " << ctag << ", cnt = " << cnt << endl;
      ans[cp]++;
    } else if (ctag == "<table>") {
      solve();
    }
  }
  if (DEBUG) cerr << "exit solve()\n";
}
int main() {
  while (!cin.eof()) {
    string line;
    getline(cin, line);
    s += line;
  }
  if (DEBUG) cerr << s;
  cp = 0;
  cnt = -1;
  next_tag();
  solve();
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << ' ';
  return 0;
}
