#include <iostream>
#include <vector>
#include <string>
using namespace std;
vector<int> naiveSearch(const string& A, const string& B) {
vector<int> positions;
int n = A.length();
int m = B.length();
// Duyệt qua từng vị trí có thể bắt đầu của xâu B trong xâu A
for (int i = 0; i <= n - m; i++) {
bool match = true;
// So sánh đoạn con A[i:i+m] với B
for (int j = 0; j < m; j++) {
if (A[i + j] != B[j]) {
match = false;
break;
}
}
// Nếu đoạn con khớp, lưu lại vị trí
if (match) {
positions.push_back(i + 1); // Chỉ số 1-based
}
}
return positions;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
string a;
string b;
cin >> a >> b;
vector<int> positions = naiveSearch(a, b);
for (int pos : positions) {
cout << pos << ' ';
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c3RyaW5nPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdmVjdG9yPGludD4gbmFpdmVTZWFyY2goY29uc3Qgc3RyaW5nJiBBLCBjb25zdCBzdHJpbmcmIEIpIHsKICAgIHZlY3RvcjxpbnQ+IHBvc2l0aW9uczsKICAgIGludCBuID0gQS5sZW5ndGgoKTsKICAgIGludCBtID0gQi5sZW5ndGgoKTsKCiAgICAvLyBEdXnhu4d0IHF1YSB04burbmcgduG7iyB0csOtIGPDsyB0aOG7gyBi4bqvdCDEkeG6p3UgY+G7p2EgeMOidSBCIHRyb25nIHjDonUgQQogICAgZm9yIChpbnQgaSA9IDA7IGkgPD0gbiAtIG07IGkrKykgewogICAgICAgIGJvb2wgbWF0Y2ggPSB0cnVlOwoKICAgICAgICAvLyBTbyBzw6FuaCDEkW/huqFuIGNvbiBBW2k6aSttXSB24bubaSBCCiAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCBtOyBqKyspIHsKICAgICAgICAgICAgaWYgKEFbaSArIGpdICE9IEJbal0pIHsKICAgICAgICAgICAgICAgIG1hdGNoID0gZmFsc2U7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgLy8gTuG6v3UgxJFv4bqhbiBjb24ga2jhu5twLCBsxrB1IGzhuqFpIHbhu4sgdHLDrQogICAgICAgIGlmIChtYXRjaCkgewogICAgICAgICAgICBwb3NpdGlvbnMucHVzaF9iYWNrKGkgKyAxKTsgLy8gQ2jhu4kgc+G7kSAxLWJhc2VkCiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIHBvc2l0aW9uczsKfQoKaW50IG1haW4oKSB7CiAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7CiAgY2luLnRpZShudWxscHRyKTsKICBzdHJpbmcgYTsKICBzdHJpbmcgYjsKICBjaW4gPj4gYSA+PiBiOwogIHZlY3RvcjxpbnQ+IHBvc2l0aW9ucyA9IG5haXZlU2VhcmNoKGEsIGIpOwogIGZvciAoaW50IHBvcyA6IHBvc2l0aW9ucykgewogICAgY291dCA8PCBwb3MgPDwgJyAnOwogIH0KfQ==