/* O(N*σ^3)でTLE */ #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const ll INF=1LL<<60; typedef pair P; typedef pair PP; const ll MOD=998244353; int main(){ int N; cin>>N; string S; cin>>S; if(N==1){ cout<<(S[0]=='?'?26:1)<>(26,vector(26,0))); vector sum(26,0); for(int j=0;j<26;j++){ if( S[0]-'a' == j || S[0]=='?' ){ for(int k=0;k<26;k++){ if(j==k) continue; if(S[1]-'a'==k || S[1]=='?'){ dp[1][j][k]=1; sum[k]+=1; sum[k]%=MOD; } } } } for(int i=2;i