Pagini recente » Cod sursa (job #1565187) | Cod sursa (job #1761541) | Cod sursa (job #769741) | Cod sursa (job #1031590) | Cod sursa (job #1920752)
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
using namespace std;
ifstream f ("strmatch.in");
ofstream t ("strmatch.out");
int main()
{
int counter=0;
vector <size_t> pos;
string match,pattern;
f>>match>>pattern;
size_t last;
for (last=pattern.find(match);last!=string::npos;++counter,last=pattern.find(match,last+1)){
if (counter<1000)
pos.push_back(last);
}
t<<counter<<'\n';
for (auto i:pos)
t<<i<<" ";
return 0;
}