#include <bits/stdc++.h>
using namespace std;
long long _set(long long N, long long pos) { return N = N | (1 << pos); }
long long _reset(long long N, long long pos) { return N = N & ~(1 << pos); }
bool _check(long long N, long long pos) { return (bool)(N & (1 << pos)); }
bool _upper(char a) { return a >= 'A' && a <= 'Z'; }
bool _lower(char a) { return a >= 'a' && a <= 'z'; }
bool _digit(char a) { return a >= '0' && a <= '9'; }
long long dx[] = {1, -1, 0, 0, -1, -1, 1, 1};
long long dy[] = {0, 0, 1, -1, -1, 1, -1, 1};
int main() {
  string s = "", t;
  while (cin >> t) {
    s += t;
  }
  long long L = s.size();
  s += "..........";
  vector<long long> a;
  for (long long i = 0; i < L; i++) {
    if (s.substr(i, 7) == "<table>") a.push_back(3);
    if (s.substr(i, 8) == "</table>") a.push_back(-3);
    if (s.substr(i, 4) == "<tr>") a.push_back(2);
    if (s.substr(i, 5) == "</tr>") a.push_back(-2);
    if (s.substr(i, 4) == "<td>") a.push_back(1);
    if (s.substr(i, 5) == "</td>") a.push_back(-1);
  }
  L = a.size();
  vector<long long> st;
  vector<long long> ans;
  long long cnt = 0;
  for (long long i = 0; i < L; i++) {
    if (a[i] == 3) st.push_back(0);
    if (a[i] == 1) st[st.size() - 1]++;
    if (a[i] == -3) ans.push_back(st[st.size() - 1]), st.pop_back();
  }
  sort(ans.begin(), ans.end());
  for (auto i : ans) cout << i << ' ';
}
