#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> ans;
  string txt;
  string tmp;
  while (cin >> tmp)
    if (tmp == "")
      break;
    else
      txt += tmp;
  vector<int> stk;
  int i = 0;
  while (i < txt.length()) {
    string look = txt.substr(i, 4);
    if (look == "<tab") {
      stk.push_back(1);
      i += 7;
    } else if (look == "<td>") {
      ++stk[stk.size() - 1];
      i += 4;
    } else if (look == "</ta") {
      ans.push_back(stk.back() - 1);
      stk.pop_back();
      i += 8;
    } else if (look == "</tr" || look == "</td")
      i += 5;
    else
      i += 4;
  }
  if (!stk.empty()) ans.push_back(stk.back());
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); ++i) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
