#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  string buf;
  while (getline(cin, buf)) s += buf;
  vector<int> a;
  string hoge;
  vector<int> cnt;
  for (int i = 0; i < s.length(); ++i) {
    if (s[i] == '<') {
      hoge = "";
    } else if (s[i] == '>') {
      if (hoge == "table") {
        cnt.push_back(0);
      }
      if (hoge == "/table") {
        a.push_back(cnt.back());
        cnt.pop_back();
      }
      if (hoge == "td") ++cnt.back();
    } else {
      hoge += s[i];
    }
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < a.size(); ++i) {
    if (i) cout << " ";
    cout << a[i];
  }
  cout << endl;
}
