#include <bits/stdc++.h>
long long gi() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) f ^= ch == '-', ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return f ? x : -x;
}
std::mt19937 rnd(time(NULL));
template <class T>
void cxk(T& a, T b) {
  a = a > b ? a : b;
}
template <class T>
void cnk(T& a, T b) {
  a = a < b ? a : b;
}
int pow(int x, int y) {
  int ret = 1;
  while (y) {
    if (y & 1) ret = 1ll * ret * x % 998244353;
    x = 1ll * x * x % 998244353;
    y >>= 1;
  }
  return ret;
}
template <class Ta, class Tb>
void inc(Ta& a, Tb b) {
  a = a + b >= 998244353 ? a + b - 998244353 : a + b;
}
template <class Ta, class Tb>
void dec(Ta& a, Tb b) {
  a = a >= b ? a - b : a + 998244353 - b;
}
char S[3010], T[3010];
int f[3010][3010], g[3010][3010];
int lcp[3010][3010];
int main() {
  scanf("%s", S + 1);
  int n = strlen(S + 1);
  scanf("%s", T + 1);
  int m = strlen(T + 1);
  f[n + 1][0] = 1;
  for (int i = n; i; --i)
    for (int j = 0, k = n - i + 1; j <= n && j <= n - i + 1; ++j, --k) {
      if (j > 0 && (j > m || S[i] == T[j]))
        inc(f[i][j], (f[i + 1][j - 1] + g[i + 1][j - 1]) % 998244353);
      if (n - k + 1 > m || S[i] == T[n - k + 1])
        inc(g[i][j], (f[i + 1][j] + g[i + 1][j]) % 998244353);
      if (j == 1)
        f[i][j] = 1ll * f[i][j] * std::min(n - m + 1, n - i + 1) % 998244353;
    }
  for (int i = n; i; --i)
    for (int j = m; j; --j)
      if (S[i] == T[j]) lcp[i][j] = lcp[i + 1][j + 1] + 1;
  int ans = n - m + 1;
  for (int i = 1; i <= m; ++i)
    if (S[i] != T[i]) ans = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if (lcp[1][j + 1] >= std::min(m - j, i - 1)) {
        inc(ans, f[i][j]);
      }
  printf("%d\n", ans);
  return 0;
}
