#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main()
{
	char large [ 1000 ];
	char small [  100 ];
	int  lensmall, lenlarge, i, k, matched;

	printf("Enter the short sequence: ");
	scanf("%s", small);
	printf("Enter the  long sequence: ");
	scanf("%s", large);
	lenlarge = strlen( large );
	lensmall = strlen( small );

	if( lensmall > lenlarge )
		{
			printf("Babi eisai mpoumpounas!\n");
			exit( 1 );
		}

	printf("The lengths are : %d %d\n", lensmall, lenlarge);

	for( i=0 ; i < lenlarge - (lensmall-1) ; i++)
		{
			matched = 0;
			for( k=0 ; k < lensmall ; k++)
			{
				if( large[ i+k ] == small[ k ] )
					{
						matched++;
					}
			}

			if( matched == lensmall)
				{
					printf("Found it at position %d\n", i+1);
				}
		}
}
