#include <bits/stdc++.h>
using namespace std;
int ans[10000];
int result[10000];
char text[10000][10];
char c;
int p;
int compare(const void *a, const void *b) {
  int aa = *(int *)a;
  int bb = *(int *)b;
  return aa - bb;
}
int main() {
  int pos = 0, len = -1, elemSize = 0;
  memset(text, 0, sizeof(text));
  while (scanf("%c", &c) != -1) {
    if (c != '>' && c != '<' && c != '\0' && c != '\n' && c != ' ')
      text[len][pos++] = c;
    if (c == '<') len++, pos = 0;
  }
  memset(ans, 0, sizeof(ans));
  memset(result, 0, sizeof(result));
  p = -1;
  int step = -1;
  for (int i = 0; i <= len; i++) {
    if (strcmp(text[i], "table") == 0) p++, elemSize++;
    if (strcmp(text[i], "/table") == 0) {
      result[++step] = ans[p];
      ans[p] = 0;
      p--;
    }
    if (strcmp(text[i], "td") == 0) ans[p]++;
  }
  qsort(result, elemSize, sizeof(result[0]), compare);
  for (int i = 0; i < elemSize; i++) printf("%d ", result[i]);
  printf("\n");
  return 0;
}
