#include <bits/stdc++.h>
using namespace std;
stack<int> St;
string s;
multiset<int> SET;
int main() {
  char c1, c2, c3, c4;
  while (cin >> c1 >> c2 >> c3 >> c4) {
    if (c2 == '/') {
      switch (c4) {
        case 'a':
          s += 't';
          cin >> c1 >> c1 >> c1 >> c1;
          break;
        case 'r':
          cin >> c1;
          break;
        case 'd':
          cin >> c1;
          break;
      }
    } else {
      switch (c3) {
        case 'a':
          s += 'T';
          cin >> c1 >> c1 >> c1;
          break;
        case 'r':
          break;
        case 'd':
          s += 'D';
          break;
      }
    }
  }
  int k = 0;
  for (int i = 0; i < s.length(); i++) {
    switch (s[i]) {
      case 'T':
        St.push(k);
        k = 0;
        break;
      case 't':
        SET.insert(k);
        k = St.top();
        St.pop();
        break;
      case 'D':
        k++;
        break;
    }
  }
  for (multiset<int>::iterator it = SET.begin(); it != SET.end(); it++) {
    cout << (*it) << ' ';
  }
  return 0;
}
