import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
private static long[] t;
private static long[]codes;
private static final long prime = 61;
private static long[] pows;
private static void build (int v, int tl, int tr) {
if (tl == tr){
t[v] = (codes[tl] * pows[tl - 1]);
}
else {
int tm = (tl + tr) / 2;
build (2 * v, tl, tm);
build (2 * v + 1, tm + 1, tr);
t[v] = (t[2 * v] + t[2 * v + 1]);
}
}
private static long sum (int v, int tl, int tr, int l, int r) {
if (l > r){
return 0;
}
if (l == tl && r == tr)
return t[v];
int tm = (tl + tr) / 2;
return sum
(2 * v, tl, tm, l,
Math.
min(r, tm
)) + sum
(2 * v
+ 1, tm
+ 1, tr,
Math.
max(l, tm
+ 1), r
); }
private static void update (int v, int tl, int tr, int pos, long newVal) {
if (tl == tr)
t[v] = (newVal * pows[pos - 1]);
else {
int tm = (tl + tr) / 2;
if (pos <= tm)
update (v*2, tl, tm, pos, newVal);
else
update (2 * v + 1, tm + 1, tr, pos, newVal);
t[v] = (t[2 * v] + t[2 * v + 1]);
}
}
String[] params
= bufferedReader.
readLine().
split(" "); int n
= Integer.
parseInt(params
[0]); codes = new long[n + 1];
pows = new long[n + 1];
t = new long[4 * n];
int k
= Integer.
parseInt(params
[1]); String a
= bufferedReader.
readLine(); for (int i = 1; i <= n; i++) {
codes[i] = a.charAt(i - 1) - 'A' + 1;
}
pows[0] = 1;
for (int i = 1; i <= n; i++) {
pows[i] = pows[i - 1] * prime;
}
build(1, 1, n);
for (int t = 0; t <k; t++) {
char q = (char) bufferedReader.read();
bufferedReader.skip(1);
if (q == '?') {
String[] query
= bufferedReader.
readLine().
split(" "); int i
= Integer.
parseInt(query
[0]); int j
= Integer.
parseInt(query
[1]); int len
= Integer.
parseInt(query
[2]); if (i > j) {
int temp = i;
i = j;
j = temp;
}
// System.out.println(sum(1, 1, n, i, i + len - 1) * pows[j - i]);
// System.out.println( sum(1, 1, n, j, j + len - 1));
if(sum(1, 1, n, i, i + len - 1) * pows[j - i] == sum(1, 1, n, j, j + len - 1)){
}
else{
}
}
else if(q == '*') {
String[] query
= bufferedReader.
readLine().
split(" "); int temp
= Integer.
parseInt(query
[0]); char c = query[1].charAt(0);
update(1, 1, n, temp, c - 'A' + 1);
}
}
}
}
aW1wb3J0IGphdmEuaW8uQnVmZmVyZWRSZWFkZXI7CmltcG9ydCBqYXZhLmlvLklucHV0U3RyZWFtUmVhZGVyOwoKcHVibGljIGNsYXNzIE1haW4gewogICAgcHJpdmF0ZSBzdGF0aWMgbG9uZ1tdIHQ7CiAgICBwcml2YXRlIHN0YXRpYyBsb25nW11jb2RlczsKICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGxvbmcgcHJpbWUgPSA2MTsKICAgIHByaXZhdGUgc3RhdGljIGxvbmdbXSBwb3dzOwogICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCBidWlsZCAoaW50IHYsIGludCB0bCwgaW50IHRyKSB7CiAgICAgICAgaWYgKHRsID09IHRyKXsKICAgICAgICAgICAgdFt2XSA9IChjb2Rlc1t0bF0gKiBwb3dzW3RsIC0gMV0pOwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgaW50IHRtID0gKHRsICsgdHIpIC8gMjsKICAgICAgICAgICAgYnVpbGQgKDIgKiB2LCB0bCwgdG0pOwogICAgICAgICAgICBidWlsZCAoMiAqIHYgKyAxLCB0bSArIDEsIHRyKTsKICAgICAgICAgICAgdFt2XSA9ICh0WzIgKiB2XSArIHRbMiAqIHYgKyAxXSk7CiAgICAgICAgfQogICAgfQoKICAgIHByaXZhdGUgc3RhdGljIGxvbmcgc3VtIChpbnQgdiwgaW50IHRsLCBpbnQgdHIsIGludCBsLCBpbnQgcikgewogICAgICAgIGlmIChsID4gcil7CiAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgIH0KICAgICAgICBpZiAobCA9PSB0bCAmJiByID09IHRyKQogICAgICAgICAgICByZXR1cm4gdFt2XTsKICAgICAgICBpbnQgdG0gPSAodGwgKyB0cikgLyAyOwogICAgICAg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ICAgcG93cyA9IG5ldyBsb25nW24gKyAxXTsKICAgICAgICB0ID0gbmV3IGxvbmdbNCAqIG5dOwogICAgICAgIGludCBrID0gSW50ZWdlci5wYXJzZUludChwYXJhbXNbMV0pOwogICAgICAgIFN0cmluZyBhID0gYnVmZmVyZWRSZWFkZXIucmVhZExpbmUoKTsKICAgICAgICBmb3IgKGludCBpID0gMTsgaSA8PSBuOyBpKyspIHsKICAgICAgICAgICAgY29kZXNbaV0gPSBhLmNoYXJBdChpIC0gMSkgLSAnQScgKyAxOwogICAgICAgIH0KICAgICAgICBwb3dzWzBdID0gMTsKICAgICAgICBmb3IgKGludCBpID0gMTsgaSA8PSBuOyBpKyspIHsKICAgICAgICAgICAgcG93c1tpXSA9IHBvd3NbaSAtIDFdICogcHJpbWU7CiAgICAgICAgfQogICAgICAgIGJ1aWxkKDEsIDEsIG4pOwogICAgICAgIGZvciAoaW50IHQgPSAwOyB0IDxrOyB0KyspIHsKICAgICAgICAgICAgY2hhciBxID0gKGNoYXIpIGJ1ZmZlcmVkUmVhZGVyLnJlYWQoKTsKICAgICAgICAgICAgYnVmZmVyZWRSZWFkZXIuc2tpcCgxKTsKICAgICAgICAgICAgaWYgKHEgPT0gJz8nKSB7CiAgICAgICAgICAgICAgICBTdHJpbmdbXSBxdWVyeSA9IGJ1ZmZlcmVkUmVhZGVyLnJlYWRMaW5lKCkuc3BsaXQoIiAiKTsKICAgICAgICAgICAgICAgIGludCBpID0gSW50ZWdlci5wYXJzZUludChxdWVyeVswXSk7CiAgICAgICAgICAgICAgICBpbnQgaiA9IEludGVnZXIucGFyc2VJbnQocXVlcnlbMV0pOwogICAgICAgICAgICAgICAgaW50IGxlbiA9IEludGVnZXIucGFyc2VJbnQocXVlcnlbMl0pOwogICAgICAgICAgICAgICAgaWYgKGkgPiBqKSB7CiAgICAgICAgICAgICAgICAgICAgaW50IHRlbXAgPSBpOwogICAgICAgICAgICAgICAgICAgIGkgPSBqOwogICAgICAgICAgICAgICAgICAgIGogPSB0ZW1wOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgLy8gU3lzdGVtLm91dC5wcmludGxuKHN1bSgxLCAxLCBuLCBpLCBpICsgbGVuIC0gMSkgKiBwb3dzW2ogLSBpXSk7CiAgICAgICAgICAgICAgICAvLyBTeXN0ZW0ub3V0LnByaW50bG4oIHN1bSgxLCAxLCBuLCBqLCBqICsgbGVuIC0gMSkpOwogICAgICAgICAgICAgICAgaWYoc3VtKDEsIDEsIG4sIGksIGkgKyBsZW4gLSAxKSAqIHBvd3NbaiAtIGldID09IHN1bSgxLCAxLCBuLCBqLCBqICsgbGVuIC0gMSkpewogICAgICAgICAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoIisiKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2V7CiAgICAgICAgICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludCgiLSIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgaWYocSA9PSAnKicpIHsKICAgICAgICAgICAgICAgIFN0cmluZ1tdIHF1ZXJ5ID0gYnVmZmVyZWRSZWFkZXIucmVhZExpbmUoKS5zcGxpdCgiICIpOwogICAgICAgICAgICAgICAgaW50IHRlbXAgPSBJbnRlZ2VyLnBhcnNlSW50KHF1ZXJ5WzBdKTsKICAgICAgICAgICAgICAgIGNoYXIgYyA9IHF1ZXJ5WzFdLmNoYXJBdCgwKTsKICAgICAgICAgICAgICAgIHVwZGF0ZSgxLCAxLCBuLCB0ZW1wLCBjIC0gJ0EnICsgMSk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cn0=