#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string s;
  cin >> s;
  size_t str_size = s.length();
  int zero_count = 0;
  int one_count = 0;
  int q_count = 0;
  for (int i = 0; i < str_size; i++) {
    if (s[i] == '0') {
      zero_count++;
    } else if (s[i] == '1') {
      one_count++;
    } else {
      q_count++;
    }
  }
  cout << zero_count << endl;
  cout << one_count << endl;
  cout << q_count << endl;
  return 0;
}
