#include <bits/stdc++.h>
char input[5001];
int data[1000];
using namespace std;
int main() {
  int r = 0;
  stack<int> s;
  char temp[10];
  int b = 0, p, count;
  while (scanf("%s", input) != EOF) {
    for (int i = 0; i < strlen(input); i++) {
      if (input[i] == '<') {
        count = 0;
        i++;
        while (i < strlen(input) && input[i] != '>') {
          temp[count++] = input[i++];
        }
      }
      if (i < strlen(input) && input[i] == '>') {
        temp[count] = '\0';
        fflush(0);
        if (strcmp(temp, "table") == 0) {
          b = 0;
          s.push(b);
        } else if (strcmp(temp, "td") == 0) {
          p = s.top();
          p++;
          s.pop();
          s.push(p);
        } else if (strcmp(temp, "/table") == 0) {
          data[r++] = s.top();
          s.pop();
        }
      } else if (i < strlen(input) && input[i] != '<')
        temp[count++] = input[i];
    }
  }
  sort(data, data + r);
  for (int k = 0; k < r; k++) printf("%d ", data[k]);
  return 0;
}
