#include <bits/stdc++.h>
using namespace std;
string str, temp;
vector<int> sizes;
int ind;
int dfs() {
  if (str[ind + 2] == 'a') {
    ind += 7;
    int c = 0;
    while (str[ind + 2] == 'r') c += dfs();
    sizes.push_back(c);
    ind += 8;
    return 0;
  }
  if (str[ind + 2] == 'r') {
    ind += 4;
    int c = 0;
    while (str[ind + 2] == 'd') c += dfs();
    ind += 5;
    return c;
  }
  if (str[ind + 2] == 'd') {
    ind += 4;
    if (str[ind + 2] == 'a') dfs();
    ind += 5;
    return 1;
  }
}
int main() {
  while (cin >> temp) str += temp;
  dfs();
  sort(sizes.begin(), sizes.end());
  for (int i = 0; i < sizes.size(); ++i) {
    printf(i ? " %d" : "%d", sizes[i]);
  }
  printf("\n");
  return 0;
}
