#include <bits/stdc++.h>
using namespace std;
int st[200000], a[200000], b[200000], n, r, ed[200000], len, ans;
string s;
char c[200000];
int main() {
  s.clear();
  for (; gets(c);) {
    len = strlen(c);
    for (int i = 0; i < len; i++) s = s + c[i];
  }
  n = 0;
  len = s.size();
  for (int i = 0, e = 1; i < len; i++)
    if (s[i] == '/')
      e = -1;
    else if ((s[i] == 't') && (s[i + 1] == 'a'))
      a[++n] = e * 1, i = i + 5, e = 1;
    else if ((s[i] == 't') && (s[i + 1] == 'r'))
      a[++n] = e * 2, i = i + 2, e = 1;
    else if ((s[i] == 't') && (s[i + 1] == 'd'))
      a[++n] = e * 3, i = i + 2, e = 1;
  r = 0;
  for (int i = 1; i <= n; i++) {
    if (abs(a[i]) != 1) continue;
    if (a[i] > 0)
      st[++r] = i;
    else
      ed[st[r]] = i, r--;
  }
  ans = 0;
  for (int i = 1; i <= n; i++)
    if (a[i] == 1) {
      r = 0;
      int cnt = 0;
      for (int j = i; j <= ed[i]; j++) {
        if (abs(a[j]) != 3) continue;
        if (a[j] > 0)
          ++r;
        else {
          r--;
          if (!r) cnt++;
        }
      }
      b[++ans] = cnt;
    }
  sort(b + 1, b + ans + 1);
  for (int i = 1; i <= ans; i++) printf("%d ", b[i]);
  return 0;
}
