Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int a,b,c,d,e,f,g=0,h,i;;
- char x[100],y[100];
- while(scanf("%s%s",x,y)!=EOF)
- {
- printf("Caso #%d:\n",++g);
- f=0;
- c=strlen(x);
- d=strlen(y);
- for(a=0;a<d;a++)
- {
- e=0;
- if(y[a]==x[0])
- {
- i=a;
- for(b=0;b<c;b++)
- {
- if(y[a]==x[b])
- {
- e++;
- a++;
- }
- else
- {
- --a;
- break;
- }
- }
- if(e==c)
- {
- f++;
- h=i;
- --a;
- }
- }
- }
- if(f==0){printf("Nao existe subsequencia\n\n");}
- else
- {
- printf("Qtd.Subsequencias: %d\nPos: %d\n\n",f,h);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement