#include #include using namespace std; using ll = long long; using pii = pair; using pll = pair; using vb = vector; using vi = vector; using vll = vector; using vvi = vector; using vvll = vector; using vpii = vector; using vpll = vector; using vs = vector; using vc = vector; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(a) (a).begin(), (a).end() #define uniq(v) sort(all(v)), (v).erase(unique(all(v)),(v).end()) #define lb(v,x) int(lower_bound(all(v),(x))-(v).begin()) #define ub(v,x) int(upper_bound(all(v),(x))-(v).begin()) #define rrep(i,n) for(int i = (int)(n) - 1; i>=0; i--) #define rep1(i,n) for(int i=1; i <=(int)(n);i++) #define reps(i,s,n) for(int i=(int)(s);i<(int)(n); i++) #define koz " " #define tor "\n" template using min_pq = priority_queue, greater>; template bool chmin(T& a, const T& b){if(b bool chmax(T& a, const T& b){if(a T ceil(T x, U y){ assert(y!=0); if(y<0) x=-x,y=-y; return (x>0 ? (x+y-1)/y : x/y); } template T floor(T x, U y){ assert(y!=0); if(y<0) x=-x,y=-y; return (x>0 ? x/y : (x-y+1)/y); } template int popcnt(T x){return __builtin_popcountll(x);} const int dx[]={1,0,-1,0,1,1,-1,-1}; const int dy[]={0,1,0,-1,1,-1,1,-1}; const int INF = 1045141919; const ll LINF = 3643648101145141919; // Z[i] = S[i..] と S[0..] の最長共通接頭辞長。全体 O(n) vi z_algorithm(const string &s){ int n = s.size(); vi z(n); z[0] = n; int l = 0, r = 0; for(int i = 1; i < n; i++){ if(i < r) z[i] = min(r - i, z[i - l]); while(i + z[i] < n && s[z[i]] == s[i + z[i]]) z[i]++; if(i + z[i] > r){ l = i; r = i + z[i]; } } return z; } void solve(){ int n,q; cin >> n >>q; string s; cin >> s; while(q--){ int t; cin >> t; if(t==1){ int idx; char c; cin >> idx >> c; idx--; s[idx]=c; } else{ string t; cin >> t; string al=t+'0'+s; vi z=z_algorithm(al); int sz=t.size(); int up=al.size(); bool ok=false; reps(i,sz+1,up){ if(z[i]==sz) ok=true; } if(ok) cout << "Yes" << tor; else cout << "No" << tor; } } } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(16); int _ = 1; //cin >> _; while(_--) solve(); }