Pagini recente » Cod sursa (job #943852) | Profil Shadowjumper169 | Cod sursa (job #666979) | Cod sursa (job #2071285) | Cod sursa (job #415181)
Cod sursa(job #415181)
#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';
if(nrap > 1000) nrap=1000;
for(int i = 1; i <= nrap; ++i)
g << v[i] <<' ';
return 0;
}