using System; using System.Collections.Generic; using System.Collections; using System.Collections.Specialized; using System.Linq; using System.Text; using System.IO; using System.Reflection; using static System.Math; using System.Numerics; using System.Threading; using System.Runtime.CompilerServices; using System.Diagnostics; //using nint=System.Int32; static class Program{ const int mod=998244353; static void Main(){ Sc sc=new Sc(); var n=sc.I; var t=sc.S; var dp=new long[2][][]; const int m=26; dp[1]=new long[m+1][]; for(int j = 0;j=0;k--) { dp[i&1][j][k]+=dp[i&1][j][k+1]; dp[i&1][j][k]%=mod; } } } else{ int j=t[i]-'a'; for(int k = 0;k<=m;k++) { if(j==k){continue;} dp[i&1][j][k]=mod+dp[(i&1)^1][k][0]-dp[(i&1)^1][k][j]+dp[(i&1)^1][k][j+1]; dp[i&1][j][k]%=mod; } for(int k = m;k>=0;k--) { dp[i&1][j][k]+=dp[i&1][j][k+1]; dp[i&1][j][k]%=mod; } } } long ans=0; if(t[n-1]=='?'){ for(int i = 0;i(int n,Func f){var a=new T[n];for(int i=0;i(int n,Func f){var a=new T[n];for(int i=0;i(int n,Func f){var a=new T[n];for(int i=0;i(int n,Func f){var a=new T[n];for(int i=0;i(){var s=Console.ReadLine().Split();return (Ct(s[0]),Ct(s[1]));} public (T,T,T) Tp3(){var s=Console.ReadLine().Split();return (Ct(s[0]),Ct(s[1]),Ct(s[2]));} public (T,T,T,T) Tp4(){var s=Console.ReadLine().Split();return (Ct(s[0]),Ct(s[1]),Ct(s[2]),Ct(s[3]));} public (T1,T2) Tp2(){var s=Console.ReadLine().Split();return (Ct(s[0]),Ct(s[1]));} public (T1,T1,T2) Tp3(){var s=Console.ReadLine().Split();return (Ct(s[0]),Ct(s[1]),Ct(s[2]));} private T Ct(string s){return (T)Convert.ChangeType(s,typeof(T));} }