Pagini recente » Cod sursa (job #1473024) | Cod sursa (job #1115690) | Cod sursa (job #443047) | Cod sursa (job #121215) | Cod sursa (job #1995639)
#include <iostream>
#include <fstream>
#include <queue>
#include <string.h>
#include <string>
using namespace std;
ifstream in("strmatch.in");
ofstream out("strmatch.out");
#define ll long long
#define pb push_back
#define ui unsigned int
const int inf = 1e9 + 5;
const int NMax = 2e6 + 5;
int N,nrSol;
int sol[NMax];
int main() {
string patt,str;
in>>patt>>str;
size_t idx = 0,
mx = str.npos;
while (true) {
idx = str.find(patt,idx);
if (idx == mx) {
break;
}
sol[++nrSol] = idx++;
};
out<<nrSol<<'\n';
nrSol = min(1000,nrSol);
for (int i=1;i <= nrSol;++i) {
out<<sol[i]<<' ';
}
in.close();out.close();
return 0;
}