MOD = 998244353 n = int(input()) s = [ord(i)-97 for i in input()] M = 28 dp = [[0]*M for _ in range(M)] dp[-1][-1] = 1 def f(v): for i in range(M): if i == v: continue for j in range(M): if j == v: continue ndp[j][v] += dp[i][j] ndp[j][v] %= MOD for v in s: ndp = [[0]*M for _ in range(M)] if v == -34: for i in range(26): f(i) else: f(v) dp = ndp print(sum(sum(di) for di in dp)%MOD)