import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] sa = br.readLine().split(" "); char[] s = sa[0].toCharArray(); char[] t = sa[1].toCharArray(); br.close(); int a = s.length; int b = t.length; int mod = 998244353; long[] dp = new long[b + 1]; dp[0] = 1; for (int i = 0; i < a; i++) { long[] wk = Arrays.copyOf(dp, b + 1); for (int j = 0; j < b; j++) { if (s[i] == t[j]) { wk[j + 1] += dp[j]; } } for (int j = 0; j <= b; j++) { wk[j] %= mod; } dp = wk; // System.out.println(Arrays.toString(wk)); } long p = power(2, a - b, mod); long ans = dp[b] * p % mod; System.out.println(ans); } static long power(long x, long n, int m) { if (n == 0) { return 1; } long val = power(x, n / 2, m); val = val * val % m; if (n % 2 == 1) { x %= m; val = val * x % m; } return val; } }