#include #define rep(i, n) for(long long i = 0; i < n; i++) #define ALL(v) (v).begin(), (v).end() #define rALL(v) (v).rbegin(), (v).rend() using namespace std; using lint = long long; using ld = long double; int main() { string s, t; cin >> s >> t; int a = 0, b = 0, ab = 0, o = 0; for (char c : s) { for (char d : t) { if (c == 'A') { if (d == 'B') { ab++; } else { a++; } } else if (c == 'B') { if (d == 'A') { ab++; } else { b++; } } else { if (d == 'O') { o++; } else if (d == 'A') { a++; } else { b++; } } } } int all = a + b + ab + o; cout << a * 100 / all << " " << b * 100 / all << " " << ab * 100 / all << " " << o * 100 / all << endl; }