In software development, Make is a utility that automatically builds executable programs and libraries from source code by reading files called makefiles which specify how to derive the target program. Though integrated development environments and language-specific compiler features can also be used to manage a build process, Make remains widely used, especially in Unix.
Now let's have a look at the grammar of makefile. Please note that in this problem, we have simplified the problem a lot, so read carefully, especially when you are familiar with such things. In this problem, makefile contains three kinds of statements:
1. Target: [component ...]
This is a statement to define a target. To build "Target", you have to generate all the files in [component ...] at first. Here is an example:
a.o: a.cc b.cc
Which means if you want to generate file a.o, you have to make sure that there are already file a.cc and b.cc in the directory.
Each component(including the target itself) will be a string which is a legal file's name, as "aaa" or "aaa.bbb". They will be separated by some spaces.
A legal file's name will only contain letters (upper case and lower case), numbers and only contain one dot (.).
There won't be two Targets sharing a same file name. Also relations between files won't form a circle.
2. Commands
This is a command shows how to build the Target, usually written after statement 1. Here is an example:
g++ a.o b.o -o main
Note this kind of commands will have
*FOUR SPACES* at the front of the line.
There maybe two or more commands after statement 1.
3. Comments
Comments begin with character '#', which should be ignored. Note that '#' can appear in any place in the line, and all character after '#' in the line shall be ignored. Here is an example:
a.o: a.cc b.cc #hello world!
This should be regarded as
a.o: a.cc b.cc
Sometimes you may find a statement is too long to be written in a single line. You can add a '\' at the end of the line, indicating that there are still part of statement at the next line. Here is an example:
main: a.o\
b.o
g++ a.o b.o -o main
This equals to the statement
main: a.o b.o
g++ a.o b.o -o main
Notice that '\' will only appear at end of the line and not appear in comments.
Now this is all a makefile will have.
You have a makefile, and you will execute Q "make" commands one by one. There are already some files in the directory.
The make command is like this:
make Target
Which will try to generate a file named "Target".
If there are no such "Target" defined in the makefile, or it cannot be built since lack of files. This command will not get executed.
Your task is, after executing each command, how many new files will appear in the directory?