#include <bits/stdc++.h>
using namespace std;
template <class T>
inline int countbit(T n) {
  return (n == 0) ? 0 : (1 + countbit(n & (n - 1)));
}
template <class T>
inline T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
const double EPS = 1e-9;
const double PI = acos(-1.0);
string text;
int tamano[1000];
int main(void) {
  memset(tamano, 0, sizeof(tamano));
  string s;
  while (cin >> s) text += s;
  int table = 0;
  int ind = -1;
  stack<int> padre;
  while (((int)(text.size())) > 0) {
    s = "";
    while (text[0] != '>') {
      s += text[0];
      text.erase(text.begin());
    }
    s += text[0];
    text.erase(text.begin());
    if (s == "<table>") {
      table++;
      padre.push(ind);
      ind = table - 1;
    } else if (s == "<td>") {
      tamano[ind]++;
    } else if (s == "</table>") {
      ind = padre.top();
      padre.pop();
    }
  }
  sort(tamano, tamano + table);
  for (int i = 0; i < table; i++) {
    if (i) cout << " ";
    cout << tamano[i];
  }
  cout << endl;
  return 0;
}
