#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
const int mod = 1000000007;
const double pi = acos(-1.0);
inline void gn(long long& x) {
  int sg = 1;
  char c;
  while (((c = getchar()) < '0' || c > '9') && c != '-')
    ;
  c == '-' ? (sg = -1, x = 0) : (x = c - '0');
  while ((c = getchar()) >= '0' && c <= '9') x = x * 10 + c - '0';
  x *= sg;
}
inline void gn(int& x) {
  long long t;
  gn(t);
  x = t;
}
inline void gn(unsigned long long& x) {
  long long t;
  gn(t);
  x = t;
}
long long gcd(long long a, long long b) { return a ? gcd(b % a, a) : b; }
long long powmod(long long a, long long x, long long mod) {
  long long t = 1ll;
  while (x) {
    if (x & 1) t = t * a % mod;
    a = a * a % mod;
    x >>= 1;
  }
  return t;
}
string s;
int gid(char c) {
  if (c == 'R') return 1;
  if (c == 'B') return 2;
  if (c == 'Y') return 3;
  if (c == 'G') return 4;
}
int ord[5];
int tt[5];
bool check() {
  int sz = s.length();
  for (int i = (0); i <= (sz - 1); i++) {
    if (s[i] == '!') continue;
    if (gid(s[i]) != ord[i % 4]) return false;
  }
  return true;
}
void calc() {
  memset((tt), 0, sizeof(tt));
  int sz = s.length();
  for (int i = (0); i <= (sz - 1); i++) {
    if (s[i] == '!') {
      tt[ord[i % 4]]++;
    }
  }
}
int main() {
  cin >> s;
  for (int i = (0); i <= (3); i++) ord[i] = i + 1;
  do {
    if (check()) {
      calc();
      break;
    }
  } while (next_permutation(ord, ord + 4));
  for (int i = (1); i <= (4); i++) cout << tt[i] << " ";
  return 0;
}
