#include <bits/stdc++.h>
using namespace std;
long long a[10000] = {0};
long long b[10000] = {0};
long long c[10000] = {0};
long long i, j, k, l, m, n, ans, xx = 0;
char s[100000] = {0};
char cs[100000] = {0};
void dfs(long long x);
long long dfss(long long x);
void dfsss(long long x);
long long dfss(long long x) {
  long long l = 0;
  while (1) {
    while (s[k] != '<') k++;
    if (s[k + 1] == 't' && s[k + 2] == 'd') {
      dfsss(1);
      l++;
    } else if (s[k + 1] == '/') {
      k++;
      return l;
      break;
    }
    k++;
  }
  return l;
}
void dfsss(long long x) {
  while (1) {
    while (s[k] != '<') k++;
    if (s[k + 1] == 't' && s[k + 2] == 'a') {
      dfs(1);
    } else if (s[k + 1] == '/') {
      k++;
      return;
      break;
    }
    k++;
  }
  return;
}
void dfs(long long x) {
  long long l = 0;
  while (1) {
    while (s[k] != '<') k++;
    if (s[k + 1] == 't' && s[k + 2] == 'r') {
      l += dfss(1);
    } else if (s[k + 1] == '/') {
      break;
    }
    k++;
  }
  k = k + 7;
  a[ans] = l;
  ans++;
  return;
}
int main(int argc, const char* argv[]) {
  while (gets(cs)) {
    strcat(s, cs);
  }
  k = 0;
  ans = 0;
  l = strlen(s) - 1;
  while (k < l) {
    dfs(1);
    if (!(k == l)) {
      while (!((s[k - 6] == '<' && s[k - 5] == 't' && s[k - 4] == 'a') ||
               (k == l)))
        k++;
    }
  }
  sort(a, a + ans);
  for (int i = 0; i < ans; i++) printf("%I64d ", a[i]);
  return 0;
}
