#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
template <class T>
inline void checkmin(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
inline void checkmax(T &a, T b) {
  if (b > a) a = b;
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
int SetBit(int N, int pos) { return N = (N | (1 << pos)); }
int ResetBit(int N, int pos) { return N = (N & ~(1 << pos)); }
string itoa(long long a) {
  string ret;
  for (long long i = a; i > 0; i = i / 10) ret.push_back((i % 10) + 48);
  reverse(ret.begin(), ret.end());
  return ret;
}
vector<string> token(string a, string b) {
  const char *q = a.c_str();
  while (count(b.begin(), b.end(), *q)) q++;
  vector<string> oot;
  while (*q) {
    const char *e = q;
    while (*e && !count(b.begin(), b.end(), *e)) e++;
    oot.push_back(string(q, e));
    q = e;
    while (count(b.begin(), b.end(), *q)) q++;
  }
  return oot;
}
double dist(double x1, double y1, double x2, double y2) {
  return sqr(x1 - x2) + sqr(y1 - y2);
}
double dist(int x1, int y1, int x2, int y2) {
  return sqr(x1 - x2) + sqr(y1 - y2);
}
int toInt(string s) {
  int r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
long long toInt64(string s) {
  long long r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
double toDouble(string s) {
  double r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
int main() {
  string S = "", W;
  while (cin >> W) {
    S += W;
  }
  string tag = "";
  int map[10000] = {0}, mm = 0, mx;
  vector<int> STK;
  vector<int> out;
  for (int i = 0; S[i]; i++) {
    tag += S[i];
    if (S[i] == '>') {
      if (tag == "<table>") {
        STK.push_back(0);
      }
      mx = max(mx, mm);
      if (tag == "</table>") {
        out.push_back(STK.back());
        STK.pop_back();
        mm--;
      }
      if (tag == "<td>") {
        STK[STK.size() - 1]++;
        map[mm]++;
      }
      tag = "";
    }
  }
  sort(out.begin(), out.end());
  for (int i = 0; i < (int)out.size(); i++) {
    if (i) printf(" ");
    printf("%d", out[i]);
  }
  puts("");
}
