#include <iostream>
#include <cstring>
using namespace std;
int main() {
char a[100001], b[100001];
int l1, l2, l, k = 0;
cin >> a >> b >> l;
l1 = strlen(a);
l2 = strlen(b);
if (l1 < l || l2 < l) cout << "NO";
else {
for (int i = 0; i < l1; i ++) {
for (int j = i; j <= l ; j ++) {
if (a[j] == b[j]) k ++;
else i++;
if (k == l) {
cout << "YES";
return 0;
}
}
k = 0;
}
cout << "NO";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKIAppbnQgbWFpbigpIHsKCWNoYXIgYVsxMDAwMDFdLCBiWzEwMDAwMV07IAoJaW50IGwxLCBsMiwgbCwgayA9IDA7CgljaW4gPj4gYSA+PiBiID4+IGw7CglsMSA9IHN0cmxlbihhKTsKCWwyID0gc3RybGVuKGIpOwoJaWYgKGwxIDwgbCB8fCBsMiA8IGwpIGNvdXQgPDwgIk5PIjsKCWVsc2UgewoJCWZvciAoaW50IGkgPSAwOyBpIDwgbDE7IGkgKyspIHsKCQkJZm9yIChpbnQgaiA9IGk7IGogPD0gbCA7IGogKyspIHsKCQkJCWlmIChhW2pdID09IGJbal0pIGsgKys7CgkJCQllbHNlIGkrKzsKCQkJCWlmIChrID09IGwpIHsKCQkJCQljb3V0IDw8ICJZRVMiOwoJCQkJCXJldHVybiAwOwoJCQkJfQoJCQl9CgkJCWsgPSAwOwoJCX0KCQljb3V0IDw8ICJOTyI7Cgl9CglyZXR1cm4gMDsKfQ==