Pagini recente » Cod sursa (job #1073997) | Cod sursa (job #178736) | Cod sursa (job #989232) | Cod sursa (job #2234839) | Cod sursa (job #2983418)
#include <iostream>
#include <fstream>
#include <cstring>
#include <algorithm>
using namespace std;
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
string A, B;
int k, poz[2000005];
int main()
{
fin >> A >> B;
size_t pos = B.find(A);
while(pos != string::npos)
{
poz[k++] = pos;
pos = B.find(A, pos + 1);
}
fout << k << '\n';
if(k <= 1000)
{
for(int i = 0; i < k; i++)
fout << poz[i] << ' ';
}
else
{
for(int i = 0; i < 1000; i++)
fout << poz[i] << ' ';
}
return 0;
}