#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const int N = 2e5 + 10;
int a[N];
int main() {
  string str;
  string s;
  while (cin >> s) str += s;
  for (auto& c : str) {
    if (c == '<') c = ' ';
    if (c == '>') c = ' ';
  }
  vector<string> vs;
  vector<int> ans;
  stringstream sin(str);
  while (sin >> str) {
    if (str[0] == '/') {
      if (str == "/table") {
        ans.push_back(a[vs.size() - 1]);
      } else {
        a[vs.size() - 2] += a[vs.size() - 1];
      }
      vs.pop_back();
      a[vs.size()] = 0;
    } else {
      if (str == "td")
        a[vs.size()] = 1;
      else
        a[vs.size()] = 0;
      vs.push_back(str);
    }
  }
  sort(ans.begin(), ans.end());
  for (auto& x : ans) printf("%d ", x);
  return 0;
}
