#include <bits/stdc++.h>
char str[6000], strMin[6000];
int ans[6000], tablesCount, lastIndex;
char* beginArray[] = {"<table>", "<tr>", "<td>"};
char* endArray[] = {"</td>", "</table>", "</tr>"};
struct ret {
  int begin;
  int cellsCount;
  bool found;
};
ret createRet() {
  ret res;
  res.begin = -1;
  res.cellsCount = 0;
  res.found = true;
  return res;
}
ret baseGo(int startIndex, int idx) {
  ret res = createRet();
  int lbegin = strlen(beginArray[idx]);
  int lend = strlen(endArray[idx]);
  for (int i = 0; i + startIndex < lastIndex; i++) {
    if (!strncmp(str + startIndex + i, beginArray[idx], lbegin)) {
      res.begin = startIndex + i;
      ret newRes = createRet();
      if (idx == 2) {
        res.cellsCount = 1;
      }
      while (true) {
        ret newRes1 = baseGo(startIndex + i, (idx + 1 > 2) ? 0 : (idx + 1));
        i = newRes1.begin - startIndex;
        res.begin = startIndex + i;
        if (newRes1.found) {
          res.cellsCount += newRes1.cellsCount;
        } else {
          break;
        }
      }
      if (idx == 0) {
        ans[tablesCount++] = res.cellsCount;
        res.cellsCount = 0;
      }
      return res;
    }
    if (!strncmp(str + startIndex + i, endArray[idx], lend)) {
      res.begin = startIndex + i;
      break;
    }
  }
  res.found = false;
  return res;
}
int main() {
  while (scanf("%s", strMin) != EOF) {
    int l = strlen(strMin);
    strncpy(str + lastIndex, strMin, l);
    lastIndex += l;
    memset(strMin, 0, 6000);
  }
  baseGo(0, 0);
  std::sort(ans, ans + tablesCount);
  for (int i = 0; i < tablesCount; i++) {
    printf("%d ", ans[i]);
  }
  return 0;
}
