#include <bits/stdc++.h>
#pragma optimization_level 3
using namespace std;
long double TL = 1.0;
bool is_tl = 0;
long long CALLS = 0;
inline bool IS() {
  if (++CALLS == 1000) {
    CALLS = 0;
    is_tl |= clock() > (TL - 0.1) * CLOCKS_PER_SEC;
  }
  return is_tl;
}
template <typename T1, typename T2>
inline void amin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void amax(T1 &a, T2 b) {
  if (a < b) a = b;
}
template <typename T>
inline void print(T &a) {
  for (auto &U : a) cout << U << ' ';
  cout << '\n';
}
const long long N = 2e5 + 7, NS = 3e3 + 7, lg = 20, sq = 550, inf = 1e9 + 7,
                mod = 998244353, SM = 1e2 + 7;
const long double eps = 1e-9;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
long long d[NS][NS];
void solve() {
  long long n, m;
  string s, t;
  cin >> s >> t;
  n = s.size();
  m = t.size();
  while (t.size() < s.size()) t += '?';
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    if (t[i] == '?' || t[i] == s[0]) d[i][i] = 2;
  }
  for (long long len = 2; len <= n; len++) {
    for (long long l = 0; l + len - 1 < n; l++) {
      long long r = len + l - 1;
      if (t[r] == '?' || s[len - 1] == t[r])
        d[l][r] = (d[l][r] + d[l][r - 1]) % mod;
      if (t[l] == '?' || s[len - 1] == t[l])
        d[l][r] = (d[l][r] + d[l + 1][r]) % mod;
    }
  }
  for (long long i = m - 1; i < n; i++) ans = (ans + d[0][i]) % mod;
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
