Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main()
- {
- int start,end,max=0,sum=0,i,j,di=0,tod1;
- char dna1[202]= {'\0'},dna2[202]= {'\0'};
- scanf("%s%s",dna1,dna2);
- for(i=0; i<strlen(dna1); i++)
- {
- di=i;
- for(j=0; j<strlen(dna2); j++)
- {
- if(dna1[i]==dna2[j])
- {
- if(sum==0) tod1=j;
- sum++;
- if(sum>max)
- {
- start=tod1;
- end=j;
- max=sum;
- }
- i++;
- if(i==strlen(dna1))
- {
- sum=0;
- break;
- }
- }
- else
- {
- i=di;
- if(sum==1) j--;
- sum=0;
- }
- }
- }
- for(i=start; i<=end; i++) printf("%c",dna2[i]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement