Pagini recente » Cod sursa (job #1689990) | Cod sursa (job #1630751) | Profil Robybrasov | Cod sursa (job #1030749) | Cod sursa (job #2017481)
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
string A, B;
int r[1003];
int main()
{
int i=0, pos=0;
getline(f, A);
getline(f, B);
f.close();
pos=B.find(A, pos);
while(pos!=string::npos)
{
r[i++]=pos;
//pos+=B.find(A[1], pos+1);
pos++;
if(i==1000)break;
pos=B.find(A, pos);
}
g<<i<<'\n';
if(!i)g<<0;
for(int j=0; j<i; j++)g<<r[j]<<' ';
return 0;
}