Cod sursa(job #415181)
| Utilizator | Data | 10 martie 2010 23:14:56 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.43 kb |
#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;
}
