#include #include #include #include using i64 = long long; using u64 = unsigned long long; #define rep(i,n) for(int i=0; i void chmin(A& l, const A& r){ if(r < l) l = r; } template void chmax(A& l, const A& r){ if(l < r) l = r; } #include using Modint = atcoder::static_modint<998244353>; using namespace std; void testcase(){ string S, T; cin >> S >> T; i64 n = T.size(); vector cnt(n+1); cnt[0] = 1; for(char c : S){ for(i64 x=n-1; x>=0; x--) if(c == T[x]){ cnt[x+1] += cnt[x]; } } Modint ans = cnt.back() * Modint(2).pow(S.size() - T.size()); cout << ans.val() << '\n'; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); testcase(); return 0; }