write a c program that found sub-sequence from a string

#include<stdio.h>
#include<string.h>
int main()
{
    int i,c=0;

    char anik[50],rob[25];

    printf("Enter any string : ");
    gets(anik);

    printf("Enter sub-string : ");
    gets(rob);

    int len1 = strlen(anik);
    int len2 = strlen(rob);

    for(i=0;i<len1;i++)
    {
        if(c == len2)
        {
            break;
        }

        if(anik[i] == rob[c])
        {
            c++;
        }

    }

    if(c == len2)
    {
        printf("Sub-sequence is found\n");
    }

    else
    {
        printf("Sub-sequence is not found\n");
    }


    return 0;
}

Comments