Pagini recente » Cod sursa (job #133809) | Cod sursa (job #848190) | Cod sursa (job #2006461) | Cod sursa (job #1905041) | Cod sursa (job #415191)
Cod sursa(job #415191)
#include<string>
#include<fstream>
using namespace std;
const char in[]="strmatch.in", out[]="strmatch.out";
ifstream f(in);
ofstream g(out);
string a, b;
int found, nrap, j;
char v[200005];
int main()
{
f >> a;
f >> b;
while(1) {
found=b.find(a);
if(found >= 0){v[j++]=found + '0';v[j++]=' ';++nrap;b[found]=-1;}
else break;}
g << nrap <<'\n'<<v;
return 0;
}