Pagini recente » Cod sursa (job #3251288) | Cod sursa (job #1294404) | Cod sursa (job #1689360) | Cod sursa (job #1526949) | Cod sursa (job #1914432)
#include <iostream>
#include <vector>
using namespace std;
string a, b;
vector <int> x;
bool f(int x)
{
for (int i = 1; i < a.size(); i++)
if (a[i] != b[i + a.size() -1]) return false;
return true;
}
int main()
{
cin >> a >> b;
for (int i = 0; i + a.size() < b.size(); i++)
{
if (a[0] == b[i] && a[a.size() - 1] == b[i + a.size() -1] && f(i))
x.push_back(i);
}
int q = x.size();
q = min(1000, q);
cout << x.size() << '\n';
for (int i = 0; i < x.size(); i++)
cout << x[i] << ' ';
return 0;
}