Check a String is SUBSEQUENCE of another String Find Minimum length for that ( DNA Matching )

Main DNA sequence(a string) is given (let say strDNA) and another string to search for(let say strPAT).
You have to find the minimum length window in strDNA where strPAT is subsequence.


Example :
strDNA = "BANANA"
strPAT = "ANNA"

Here ANNA is sub-sequence of BANANA (click sub-sequence to understand sub-sequence).
Length is 5 ANANA contains ANNA.

There are several ways to check for occurrence of string as subsequence of another string.
Through DP we can find more efficient answer for minimum length.
Considering simple case I have written code to check whether strPAT is subsequence of strDNA or not.

Thanks to Dhaval for suggesting this approach and Article

#include <stdio.h> 
main() { 
    char *x,*y;
    int count=0;
    int f=0;
    char a[]="anna";
    char b[]="banana";
x=a; y=b;
        while(*y){
           if(*x==*y){
               x++;
               f=1;
           }
           if(f==1)count++;
           *y++;
        }
if (*x!='\0') 
    printf("\n false (%s)\n",x);
else
    printf("\ntrue %d\n",count);

 }

You Can Check code at http://ideone.com/y4P2oI