#include <bits/stdc++.h>
int main() {
  int a[4], n[4];
  for (int i = 0; i < 4; i++) {
    a[i] = 0;
    n[i] = 0;
  }
  char ch[105];
  scanf("%s", &ch);
  for (int i = 0; i < strlen(ch); i++) {
    if (ch[i] == 'R') a[i % 4] = 1;
    if (ch[i] == 'B') a[i % 4] = 2;
    if (ch[i] == 'Y') a[i % 4] = 3;
    if (ch[i] == 'G') a[i % 4] = 4;
    if (a[1] + a[2] + a[3] + a[0] == 10) break;
  }
  int n1;
  if (a[1] + a[2] + a[3] + a[0] != 10) {
    n1 = a[1] + a[2] + a[3] + a[0];
    for (int i = 0; i < 4; i++)
      if (a[i] == 0) a[i] = 10 - n1;
  }
  for (int i = 0; i < strlen(ch); i++)
    if (ch[i] == '!') {
      n[a[i % 4] - 1]++;
    }
  printf("%d %d %d %d", n[0], n[1], n[2], n[3]);
}
