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