Pagini recente » Statistici Vlad Constantinescu (Vlad_78) | Monitorul de evaluare | Cod sursa (job #1609752) | Cod sursa (job #1179751) | 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;
}