#include #include #include using namespace std; using i64 = int64_t; using u64 = uint64_t; #define rep(i,n) for(int i=0; i<(n); i++) const i64 MOD = 998244353; int main() { int N; cin >> N; string S; cin >> S; i64 ans = 1; rep(i,N-1) if(S[i] != '?' && S[i] == S[i+1]) ans = 0; rep(i,N-2) if(S[i] != '?' && S[i] == S[i+2]) ans = 0; vector C(N); rep(i,N) if(S[i] == '?'){ int t = 26; if(i >= 1) t--; if(i >= 2) t--; if(i < N-1) if(S[i+1] != '?') t--; if(i < N-2) if(S[i+2] != '?') t--; ans = ans * t % MOD; } cout << ans << endl; return 0; } struct ios_do_not_sync{ ios_do_not_sync(){ ios::sync_with_stdio(false); cin.tie(nullptr); } } ios_do_not_sync_instance;