Cod sursa(job #693487)
Utilizator | Data | 27 februarie 2012 12:59:57 | |
---|---|---|---|
Problema | Potrivirea sirurilor | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.43 kb |
#include <fstream>
using namespace std;
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
int main()
{
char a[200],b[2000];
unsigned int v[1000],s,k=0;
fin>>a;
fin>>b;
for(int i=0;i<strlen(b);i++)
{
s=0;
for(int j=0;j<strlen(a);j++)
{
if(b[i+j]!=a[j])
break;
s++;
if(s==3)
{
v[k]=i;
k++;
}
}
}
fout<<k<<endl;
for(int i=0;i<k;i++)
fout<<v[i]<<" ";
}