Pagini recente » Cod sursa (job #1585592) | Cod sursa (job #2061346) | Cod sursa (job #1653906) | Cod sursa (job #1575232) | Cod sursa (job #415175)
Cod sursa(job #415175)
#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, v[1005];
int main()
{
f >> a;
f >> b;
while(1) {
found=b.find(a);
if(found > 0){v[++nrap]=found;b[found]=-1;}
else break;}
g << nrap <<'\n';
for(int i = 1; i <= (nrap > 1000 ? 1000 : nrap); ++i)
g << v[i] <<' ';
return 0;
}