#include <stdio.h>
#include <stdlib.h>
/*
 * Program to 
 * Terry Harvey CISC 105 section 98 TA James Jamerson
 */
void lowerCase(char word[]);
int main(){
    char word[30];
    int count = 0;
    FILE * in = fopen("data", "r");

    if(in == NULL){
	printf("error opening file");
	exit(1);
    }

    fscanf(in, "%s", word);

    while( ! feof(in) ){
	lowerCase( word);
	if (0 == strcmp(word, "the") )//The THE The tHe
	    count++;

	fscanf(in, "%s", word);
    }
    printf("count is %d\n", count);

    return 0;
}

void lowerCase(char word[]){
    int i = 0;
    while(word[i] != '\0'){
	word[i] = tolower(word[i]);
	i++;
    }
    return;
}
