#include <bits/stdc++.h>
using namespace std;
map<string, int> codigo;
int large[100000], cant = 1000, pos = 0;
vector<int> Q;
int main() {
  codigo["<td>"] = 2;
  codigo["<table>"] = 1;
  codigo["</table>"] = -1;
  string in, aux;
  while (cin >> aux) in = in + aux;
  aux = "";
  int L = in.size();
  for (int i = 0; i < 999; i++) Q.push_back(i);
  for (int i = 0; i < L; i++) {
    aux += in[i];
    if (in[i] == '>') {
      int c = codigo[aux];
      aux = "";
      if (c == -1) {
        Q.pop_back();
        pos = Q.back();
      } else if (c == 1) {
        Q.push_back(cant);
        pos = cant;
        cant++;
      } else if (c == 2) {
        large[pos]++;
      }
    }
  }
  sort(large + 1000, large + cant);
  for (int i = 1000; i < cant; i++) printf("%d ", large[i]);
}
