Cod sursa(job #812298)
| Utilizator | Data | 13 noiembrie 2012 18:59:36 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.49 kb |
#include<stdio.h>
#include<string.h>
#include<vector>
using namespace std;
vector<int> sol;
char a[2000005],b[2000005];
int strmatch(char *s,char *s1)
{
char *p;int nr=0;
p=strstr(s,s1);
while(p)
{
nr++;
sol.push_back(p-s);
p=strstr(p+1,s1);
}
return nr;
}
int main()
{
//freopen("strmatch.in","r",stdin);
//freopen("strmatch.out","w",stdout);
gets(a);
gets(b);
printf("%d\n",strmatch(b,a));
for(int i=0;i<sol.size();i++)
printf("%d ",sol[i]);
return 0;
}
