#include <bits/stdc++.h>
using namespace std;
char str[5005];
int ans[5005], res;
int stk[5005], top;
void table(int, int);
void rows(int, int);
void row(int, int);
void cells(int, int);
void cell(int, int);
void table(int l, int r) {
  if (false) {
    printf("table: ");
    for (int i = l; i < r; i++) putchar(str[i]);
    puts("");
  }
  res++;
  stk[++top] = res;
  rows(l + 1, r - 1);
  --top;
}
void rows(int l, int r) {
  if (false) {
    printf("rows: ");
    for (int i = l; i < r; i++) putchar(str[i]);
    puts("");
  }
  int k = 0, tl = l;
  for (int i = l; i < r; i++) {
    if (str[i] == '[') {
      k++;
      continue;
    }
    if (str[i] == ']') k--;
    if (k == 0) {
      row(tl, i + 1);
      tl = i + 1;
    }
  }
}
void row(int l, int r) {
  if (false) {
    printf("row: ");
    for (int i = l; i < r; i++) putchar(str[i]);
    puts("");
  }
  cells(l + 1, r - 1);
}
void cells(int l, int r) {
  if (false) {
    printf("cells: ");
    for (int i = l; i < r; i++) putchar(str[i]);
    puts("");
  }
  int k = 0, tl = l;
  for (int i = l; i < r; i++) {
    if (str[i] == '(') {
      k++;
      continue;
    }
    if (str[i] == ')') k--;
    if (k == 0) {
      cell(tl, i + 1);
      tl = i + 1;
    }
  }
}
void cell(int l, int r) {
  if (false) {
    printf("cell: ");
    for (int i = l; i < r; i++) putchar(str[i]);
    puts("");
  }
  ans[stk[top]]++;
  if (l + 2 != r) table(l + 1, r - 1);
}
char tmp[5005], tstr[5005];
int main() {
  tstr[0] = 0;
  while (~scanf("%s", tmp)) {
    strcat(tstr, tmp);
  }
  int n = 0;
  for (int i = 0; tstr[i];) {
    i++;
    if (tstr[i] == '/') {
      i += 2;
      if (tstr[i] == 'a') {
        str[n++] = '}';
        i += 5;
      } else if (tstr[i] == 'r') {
        str[n++] = ']';
        i += 2;
      } else if (tstr[i] == 'd') {
        str[n++] = ')';
        i += 2;
      }
    } else {
      i += 1;
      if (tstr[i] == 'a') {
        str[n++] = '{';
        i += 5;
      } else if (tstr[i] == 'r') {
        str[n++] = '[';
        i += 2;
      } else if (tstr[i] == 'd') {
        str[n++] = '(';
        i += 2;
      }
    }
  }
  str[n] = 0;
  memset(ans, 0, sizeof(ans));
  top = -1;
  res = -1;
  table(0, n);
  res++;
  sort(ans, ans + res);
  for (int i = 0; i < res; i++) {
    printf("%d ", ans[i]);
  }
}
