#include <bits/stdc++.h>
using namespace std;
int dicta[500];
int dictb[10];
int where[10];
int whereb[10];
int visa[10];
char stra[500];
int ansa[10];
int main() {
  dicta['R'] = 1;
  dicta['B'] = 2;
  dicta['Y'] = 3;
  dicta['G'] = 4;
  dictb[1] = 'R';
  dictb[2] = 'B';
  dictb[3] = 'Y';
  dictb[4] = 'G';
  scanf("%s", stra + 100);
  int lena = strlen(stra + 100);
  int flag0 = 1;
  where[1] = -1;
  where[2] = -1;
  where[3] = -1;
  where[4] = -1;
  for (int i = 100; i < 100 + lena; i++) {
    if (stra[i] == '!') {
      continue;
    }
    where[dicta[stra[i]]] = i % 4;
    visa[i % 4]++;
  }
  for (int i = 1; i <= 4; i++) {
    if (where[i] == -1) {
      for (int j = 0; j < 4; j++) {
        if (visa[j] == 0) {
          where[i] = j;
          goto outa;
        }
      }
    }
  }
outa:
  0;
  for (int i = 1; i <= 4; i++) {
    whereb[where[i]] = i;
  }
  for (int i = 100; i < 100 + lena; i++) {
    if (stra[i] != '!') {
      continue;
    }
    ansa[whereb[i % 4]]++;
  }
  for (int i = 1; i <= 4; i++) {
    printf("%d\n", ansa[i]);
  }
  return 0;
}
