Cod sursa(job #99699)
| Utilizator | Data | 11 noiembrie 2007 15:09:50 | |
|---|---|---|---|
| Problema | Abc2 | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Happy Coding 2007 | Marime | 0.58 kb |
#include<stdio.h>
#include<string.h>
int i,j,pos,a,b,lungime[50000],l1;
char v[10000000],w[50000][21];
int main()
{
freopen("abc2.in","r",stdin);
freopen("abc2.out","w",stdout);
scanf("%s",v);
l1=strlen(v);
while(!feof(stdin))
{
a++;
scanf("%s",w[a]);
lungime[a]=strlen(w[a]);
}
for(i=1;i<a;i++)
for(j=i+1;j<=a;j++)
if(strcmp(w[i],w[j])==0)
{
w[j][1]='x';
}
for(i=1;i<=l1;i++)
{
for(j=1;j<=a;j++)
if(strncmp(v+i-1,w[j],lungime[j])==0)
pos++;
}
printf("%d",pos);
return 0;
}
