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) ndp = [0]*(l+1) dp[0] = 1 for i in range(n): for j in range(l+1): if j != l and s[i] == t[j]: ndp[j+1] += dp[j]%mod ndp[j] += dp[j]*2%mod dp = ndp[:] ndp = [0]*(l+1) # print(dp) print(dp[-1]%mod)