#include <bits/stdc++.h>
using namespace std;
const int N = 3005, MOD = 998244353;
string s, t;
int n;
int dp[N][N];
int go(int f, int b) {
  int &ans = dp[f][b];
  if (ans != -1) return ans;
  ans = 0;
  if (f && (t[f - 1] == '?' || t[f - 1] == s[n - f - b])) ans += go(f - 1, b);
  if (b && (t[n - b] == '?' || t[n - b] == s[n - f - b])) ans += go(f, b - 1);
  if (!f && t[n - b] == '?') ans++;
  ans %= MOD;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s >> t;
  n = int(s.size());
  while (int(t.size()) < n) t += '?';
  int ans = 0;
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 1;
  for (int i = 0; i <= n; ++i) {
    ans = (ans + go(i, n - i)) % MOD;
  }
  cout << ans << endl;
  return 0;
}
