Language: C++

#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

template<int Modulo = MOD> struct Mint {
	lint val;
	constexpr Mint(lint v = 0) noexcept : val(v % Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		lint a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			lint t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint operator + (const Mint& r) const noexcept { return *this += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return *this -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return *this *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return *this /= r; }
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream &operator << (ostream &os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream &is, Mint<Modulo>& x) noexcept {
		lint tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo> &a, lint n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	string S;
	cin >> S;

	vector<vector<mint>> dp(S.size() + 1, vector<mint>(4));
	dp[0][0] = 1;
	for (int i = 0; i < S.size(); i++) {
		for (int j = 0; j <= 3; j++) {
			for (int k = 0; k <= 2; k++) {
				if (!(S[i] != '?' && S[i] != 'A' + k)) {

					dp[i + 1][j] += dp[i][j];

					if (j == k) {
						dp[i + 1][j + 1] += dp[i][j];
					}

				}
			}
		}
	}

	cout << dp[S.size()][3] << "\n";

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:90:23: error: 'mint' was not declared in this scope; did you mean 'Mint'?
   90 |         vector<vector<mint>> dp(S.size() + 1, vector<mint>(4));
      |                       ^~~~
      |                       Mint
a.cc:90:23: error: template argument 1 is invalid
a.cc:90:23: error: template argument 2 is invalid
a.cc:90:27: error: template argument 1 is invalid
   90 |         vector<vector<mint>> dp(S.size() + 1, vector<mint>(4));
      |                           ^~
a.cc:90:27: error: template argument 2 is invalid
a.cc:90:58: error: template argument 2 is invalid
   90 |         vector<vector<mint>> dp(S.size() + 1, vector<mint>(4));
      |                                                          ^
a.cc:90:62: error: expression list treated as compound expression in initializer [-fpermissive]
   90 |         vector<vector<mint>> dp(S.size() + 1, vector<mint>(4));
      |                                                              ^
a.cc:91:11: error: invalid types 'int[int]' for array subscript
   91 |         dp[0][0] = 1;
      |           ^
a.cc:97:43: error: invalid types 'int[int]' for array subscript
   97 |                                         dp[i + 1][j] += dp[i][j];
      |                                           ^
a.cc:97:59: error: invalid types 'int[int]' for array subscript
   97 |                                         dp[i + 1][j] += dp[i][j];
      |                                                           ^
a.cc:100:51: error: invalid types 'int[int]' for array subscript
  100 |                                                 dp[i + 1][j + 1] += dp[i][j];
      |                                                   ^
a.cc:100:71: error: invalid types 'int[int]' for array subscript
  100 |                                                 dp[i + 1][j + 1] += dp[i][j];
      |                                                                       ^
a.cc:108:19: error: invalid types 'int[std::__cxx11::basic_string<char>::size_type {aka long unsigned int}]' for array subscript
  108 |         cout << dp[S.size()][3] << "\n";
      |                   ^