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

int main()
{
	char seq  [ 1000 ];
	char penta[ 1000 ];
	int  len, i, total=0;

	printf("Enter the pentapeptide: ");
	scanf("%s", penta);
	printf("Enter the long  sequence: ");
	scanf("%s", seq);
	len = strlen( seq );

	if( len < 5 || strlen(penta) != 5 )
		{
			printf("Babi eisai mpoumpounas!\n");
			exit( 1 );
		}

	printf("The length is : %d\n", len);

	for( i=0 ; i < len-4 ; i++)
		{
			if( seq[ i   ] == penta[0] &&
				seq[ i+1 ] == penta[1] &&
				seq[ i+2 ] == penta[2] &&
				seq[ i+3 ] == penta[3] &&
				seq[ i+4 ] == penta[4] )
				{
					printf("Found it at position %d\n", i+1);
					total++;
				}
		}
	printf("Found it a total of %d times\n", total);
}
