#include <bits/stdc++.h>
using namespace std;
using LL = long long;
template <class T>
inline bool asMn(T &a, const T &b) {
  return a > b ? a = b, true : false;
}
template <class T>
inline bool asMx(T &a, const T &b) {
  return a < b ? a = b, true : false;
}
inline int nxt(int i, int n) { return i == n - 1 ? 0 : i + 1; }
inline int prv(int i, int n) { return !i ? n - 1 : i - 1; }
const int mod = 998244353;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
struct Mint {
  int a;
  Mint(int _a = 0) : a(_a) {}
  friend ostream &operator<<(ostream &out, const Mint &_) {
    out << _.a;
    return out;
  }
  bool operator==(const Mint &_) const { return a == _.a; }
  bool operator!() const { return !a; }
  Mint operator+(const Mint &_) const {
    int ret = a + _.a;
    return ret < mod ? Mint(ret) : Mint(ret - mod);
  }
  Mint operator-(const Mint &_) const { return *this + Mint(mod - _.a); }
  Mint operator*(const Mint &_) const { return Mint((int)((LL)a * _.a % mod)); }
  friend Mint &operator+=(Mint &a, const Mint &b) { return a = a + b; }
  friend Mint &operator-=(Mint &a, const Mint &b) { return a = a - b; }
  friend Mint &operator*=(Mint &a, const Mint &b) { return a = a * b; }
  Mint &operator++() { return *this = *this + Mint(1); }
  Mint &operator--() { return *this = *this - Mint(1); }
  template <class T>
  Mint binPow(T exp) const {
    Mint ret(1), c = *this;
    for (; exp; exp >>= 1, c *= c)
      if (exp & 1) ret *= c;
    return ret;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  vector<vector<Mint> > f(((int)(s).size()), vector<Mint>(((int)(s).size())));
  for (int i = 0; i < ((int)(t).size()); ++i)
    if (t[i] == s[0]) f[i][i] = Mint(2);
  for (int i = ((int)(t).size()); i < ((int)(s).size()); ++i) f[i][i] = Mint(2);
  for (int dist = 1; dist < ((int)(s).size()); ++dist) {
    for (int i = 0, j = dist; j < ((int)(s).size()); ++i, ++j) {
      if (j < ((int)(t).size())) {
        if (s[dist] == t[j]) f[i][j] += f[i][j - 1];
      } else
        f[i][j] += f[i][j - 1];
      if (i < ((int)(t).size())) {
        if (s[dist] == t[i]) f[i][j] += f[i + 1][j];
      } else
        f[i][j] += f[i + 1][j];
    }
  }
  cout << accumulate((((int)(t).size()) - 1) + (f[0]).begin(), (f[0]).end(),
                     Mint(0))
       << '\n';
  return 0;
}
