0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-10 05:18:49 +00:00
OI-codes/Luogu/P3375/P3375.cpp
2022-01-24 20:41:50 +08:00

33 lines
687 B
C++

#include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::endl;
int border[1000005];
std::string s1, s2;
int main() {
cin >> s1 >> s2;
for (int i = 0; i < s1.size(); i++) {
bool flag = false;
if (s1.substr(i, s2.size()) == s2) {
cout << i + 1 << endl;
}
}
for (int i = 0; i < s2.size(); i++) {
bool flag = false;
for (int j = i; j > 0; j--) {
if (s2.substr(0, j) == s2.substr(i - j + 1, j)) {
flag = true;
cout << j << ' ';
break;
}
}
if (!flag) cout << 0 << ' ';
}
cout << endl;
return 0;
}