def II() -> int : return int(input()) def MI() -> int : return map(int, input().split()) def TI() -> tuple[int] : return tuple(MI()) def LI() -> list[int] : return list(MI()) class fenwick_tree(): n=1 data=[0 for i in range(n)] def __init__(self,N): self.n=N self.data=[0 for i in range(N)] def add(self,p,x): assert 0<=p0): s+=self.data[r-1] r-=r&-r return s mod = 998244353 s,t = input().split() n = len(s) l = len(t) dp = [[0]*(l+1) for i in range(n+1)] dp[0][0] = 1 for i in range(n): for j in range(l+1): if j != l and s[i] == t[j]: dp[i+1][j+1] += dp[i][j]%mod dp[i+1][j] += dp[i][j]*2%mod # print(dp) print(dp[-1][-1]%mod)