#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const int maxN = 1e6 + 9;
int n, k, maxim = 0;
int arr[maxN], ans[maxN];
string s;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> s;
  vector<char> vec = {'R', 'B', 'Y', 'G'};
  int pom = 0, sum = 0;
  for (int i = (0); i <= (((int)s.size()) - 1); ++i) {
    if (s[i] != '!' && arr[s[i]] == 0) {
      arr[s[i]] = (i % 4) + 1;
      arr[(i % 4) + 1] = s[i];
    }
  }
  for (int i = (0); i <= (((int)s.size()) - 1); ++i) {
    if (s[i] == '!') ans[arr[i % 4 + 1]]++;
  }
  for (auto c : vec) cout << ans[c] << endl;
  return 0;
}
