#include using namespace std; struct iofast_t { iofast_t() { ios::sync_with_stdio(false); cin.tie(nullptr); } } iofast; struct uns_t {} uns; template auto vec(Element init, Head arg, Args ...args) { if constexpr (sizeof...(Args) == 0) return std::vector(arg, init); else return std::vector(arg, vec(init, args...)); } template auto vec(uns_t, Head arg, Args ...args) { return vec(Element(), arg, args...); } template > T &chmin(T &l, T r, Compare &&f = less()) { return l = min(l, r, f); } template > T &chmax(T &l, T r, Compare &&f = less()) { return l = max(l, r, f); } #include using mint = atcoder::modint998244353; int main() { int n; cin >> n; string s; cin >> s; for (int i = 0; i < n - 1; ++i) { if (s[i] == '?' || s[i + 1] == '?') { continue; } if (s[i] == s[i + 1]) { cout << 0 << endl; return 0; } } for (int i = 0; i < n - 2; ++i) { if (s[i] == '?' || s[i + 2] == '?') { continue; } if (s[i] == s[i + 2]) { cout << 0 << endl; return 0; } } mint ans = 1; for (int i = 0; i < n; ++i) { if (s[i] != '?') { continue; } int l = i - max(0, i - 2); int r = min(n, i + 3) - (i + 1); for (int j = i + 1; j < min(n, i + 3); ++j) { r -= s[j] == '?'; } ans *= 26 - (l + r); } cout << ans.val() << endl; }