#include #include #include #include #include #include #include #include #include #include #include #include #define all(v) (v).begin(), (v).end() #define rep(i, j) for (ll i = 0; i < j; ++i) #define rep2(i, j, k) for (ll i = j; i <= k; ++i) #define rep3(i, j, k) for (ll i = j; i >= k; --i) using namespace std; using ld = long double; using ll = long long; using pi = pair; using pl = pair; using vi = vector; using vl = vector; using vpi = vector; using vpl = vector; using vvi = vector; using vvl = vector; using vvpi = vector; using vvpl = vector; template using pqg = priority_queue, greater>; template inline bool chmax(S& x, T y) { if (x < y) { x = y; return 1; } return 0; } template inline bool chmin(S& x, T y) { if (x > y) { x = y; return 1; } return 0; } constexpr int INF = 1000000000; constexpr int MAX = 5005; constexpr int MOD = 998244353; constexpr ll INFLL = 1000000000000000000; int main(void) { int n; cin >> n; string s; cin >> s; ll ans = 1; rep(i, n) { if (s[i] == '?') { ll opt = 26; if (i - 2 >= 0) --opt; if (i - 1 >= 0) --opt; if (i + 1 < n && s[i + 1] != '?') --opt; if (i + 2 < n && s[i + 2] != '?') --opt; ans *= opt; ans %= MOD; } else { bool ok = true; if (i - 2 >= 0 && s[i - 2] == s[i]) ok = false; if (i - 1 >= 0 && s[i - 1] == s[i]) ok = false; if (ok) continue; cout << 0 << endl; return (0); } } cout << ans << endl; return (0); }