Simple English Grammar
Problem 9 Division I / II 10 Points
Problem Statement
Many computer programs need to read and understand complex data stored or presented in a grammar. For instance, compilers parse through program source code, and some programs even have a limited natural language interface.
     For this problem you will write a program to read a sequence of English words and indicate if they fit the following simple grammar model. (The square brackets indicate optional elements.)

[article] [adjective] noun [adverb] verb [[article] [adjective] noun]

Program Input
Your program must read two files. The first, ELEMENTS.TXT, contains a list of valid parts of speech: adjectives, adverbs, articles, nouns, and verbs, in that order. The file is divided into sections headed by the part of speech enclosed in square brackets. The program should allow up to 100 words for each section. If more than one form of a word is needed, each will be listed separately, such as: play, plays, and played.

     Secondly, each line of the file PROG09.IN contains a word sequence separated by one or more spaces with no punctuation. The file will not contain blank lines.
the contest quickly progresses
choosey artists choose gif
this sequence no verb
Program Output
For each line in the input file the program should analyze the word sequence according to the grammar pattern given above. All word compares should be case INSENSITIVE (so 'play' matches 'PLAY'). If the word sequence matches the pattern, the program should write the word 'valid' to the output file PROG09.OUT. If not, it should write 'INVALID'. The program must write one line for each line in the input file.