#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:836777216")
using namespace std;
char s[5005];
int main(void) {
  string a = "";
  while (scanf("%s", &s) == 1) {
    a += (string)s;
  }
  stack<int> st;
  int i = 0;
  vector<int> ans;
  while (i < (int)(a).size()) {
    if (a.find("<table>", i) == i) {
      st.push(0);
      i += 7;
    } else if (a.find("</table>", i) == i) {
      ans.push_back(st.top());
      st.pop();
      i += 8;
    } else if (a.find("<tr>", i) == i) {
      i += 4;
    } else if (a.find("</tr>", i) == i) {
      i += 5;
    } else if (a.find("<td>", i) == i) {
      int x = st.top();
      st.pop();
      x++;
      st.push(x);
      i += 4;
    } else if (a.find("</td>", i) == i) {
      i += 5;
    }
  }
  sort((ans).begin(), (ans).end());
  for (int(i) = 0; (i) < ((int)(ans).size()); (i)++) {
    printf("%d%c", ans[i], " \n"[i == (int)(ans).size() - 1]);
  }
}
