#include <bits/stdc++.h>
using namespace std;
int k[4];
int main() {
  string s;
  int r = -1, b = -1, y = -1, g = -1;
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '!') {
      k[(i + 1) % 4]++;
    } else {
      if (s[i] == 'R') {
        r = (i + 1) % 4;
      }
      if (s[i] == 'B') {
        b = (i + 1) % 4;
      }
      if (s[i] == 'Y') {
        y = (i + 1) % 4;
      }
      if (s[i] == 'G') {
        g = (i + 1) % 4;
      }
    }
  }
  cout << k[r] << " " << k[b] << " " << k[y] << " " << k[g];
}
