#include #include #include using namespace std; using ll = long long; using namespace atcoder; mt19937_64 rng(time(0)); ll BASE = rng() % 998244353; //Rolling Hash on Segment Tree using S = modint998244353; S op(S a, S b){ return a+b; } S e() { return 0; } int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); /* tがSの接頭辞であるか? t[1:|T|]=S[1:|T|] Rolling Hash */ ll N, L, Q, t, k; char c, d; string T; cin >> N >> L >> Q; vector s(N); vector p(L); p[0] = 1; for (int j=1; j> tree; for (int i=0; i> s[i]; vector v(L); for (int j=0; j(v)); }; while(Q--){ cin >> t; if (t == 1){ cin >> k >> c >> d; k--; for (int i=0; i> T; int ans=0; S x=0; for (int i=0; i