#include <bits/stdc++.h>
using namespace std;
int inf = 1 << 30;
vector<int> tams;
int sz;
int pos = 0;
string s;
void recurse() {
  int cnt = 0;
  pos += 7;
  while (true) {
    if (s[pos + 1] == '/' && s[pos + 2] == 't' && s[pos + 3] == 'a')
      break;
    else if (s[pos + 2] == 'd')
      pos += 4;
    else if (s[pos + 3] == 'd')
      pos += 5, cnt++;
    else if (s[pos + 2] == 'r')
      pos += 4;
    else if (s[pos + 3] == 'r')
      pos += 5;
    else if (s[pos + 2] == 'a')
      recurse();
  }
  pos += 8;
  tams.push_back(cnt);
}
int main() {
  string t;
  while (getline(cin, t)) s += t;
  sz = s.size();
  recurse();
  sort((tams).begin(), (tams).end());
  for (int i = 0; i < tams.size(); i++) {
    if (i) cout << " ";
    cout << tams[i];
  }
  cout << endl;
}
