#P2373. Call Stack Function Counter

    ID: 15645 Type: Default 1000ms 256MiB

Call Stack Function Counter

Call Stack Function Counter

Your team is tasked with developing a component of a Debugger called the Call Stack. One of its functions is to distinguish between functions based solely on their function name (case‐insensitive) and the types in their parameter lists. In other words, parameters names are irrelevant and only the types matter.

For example, the following two declarations are considered different functions:

[ int; fac1(int; n); ] [ int; fac1(char; n); ]

However, these two declarations are considered the same function (ignoring case and parameter names):

[ int; Fac1(int; n, int; m); ] [ int; FAC1(int; x, int; y); ]

Note that the function declaration int main() may or may not appear, but it should never be counted. It is guaranteed that every function (except main) is called at least once.

Your task is to write a program that reads a list of function declarations and, after processing all the calls, outputs the number of distinct functions (defined by their case-insensitive name and exact sequence of parameter types) present in the program (excluding main).

Input Format: The first line contains an integer n representing the number of function declarations. The next n lines each contain a function declaration of the form:

[ ; ( [, ]*); ]

Output Format: Output a single integer: the number of distinct functions (excluding main).

inputFormat

The input consists of multiple lines:

  • The first line contains an integer n indicating the number of function declarations.
  • The following n lines each contain a function declaration. Each declaration follows the format:
 ( [,  ]*);

Note: There may be extra spaces in the input and int main() should not be counted.

outputFormat

Output a single integer representing the number of distinct functions called (excluding main), where functions are identified by their case-insensitive name and the exact sequence of parameter types.

sample

3
int fac1(int n);
int fac1(char n);
int FAC1(int n,int m);
3