Hi, the following program prompts the user to enter a few lines of string and a character as a search key and outputs the total number of times that character appeared in those lines entered. However the bug is that the program prints "Enter string" twice and then i can't enter the first string. How come?

thnx in advance

Code:
/* character occurence count */

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

int main()
{
   int   occurrenceCount = 0;
   char   *searchPtr;
   char string[ 400 ];
   char tempStr[ 150 ];
   int numLines;
   int i;
   char key;

   printf( "Number of lines to be inputted: " );
   scanf( "%d", &numLines );



   for ( i = 0; i < numLines; i++ ) {
      printf( "Enter string: " );
      gets( tempStr );
      strcat( string, tempStr );
   }

   printf( "Enter search character: " );
   scanf( "%c", &key );

   searchPtr = strchr( string, key );

   while ( searchPtr != NULL ) {
      ++occurrenceCount;
      searchPtr = strchr( searchPtr + 1, key );
   }

   printf( "\n\nTotal of occurrence character \'%c\' appeared in line(s) entered: %d\n\n",
           key, occurrenceCount );

   system( "PAUSE" );
   return 0;
}