eolymp
bolt
Try our new interface for solving problems
Problems

The programming competition

The programming competition

Vova conducts programming competitions and trainings in his school. To do this, he downloaded from Internet a lot of archives with programming competitions and trainings. He unpacked everything he downloaded to the hard drive of his computer, and now can not make out with the resulting set of files. Vova wants to understand how many descriptions of programming competitions he downloaded. The pair of files is called \textit{test}, if they are situated in one directory and their full names have the form "\textbf{XY}" or "\textbf{XY.a}", where "\textbf{XY}" is the test case number (supplemented with a leading zero if it is less than ten). The first of these files contains the input data, the second contains the answer. The directory is called \textit{a directory with tests}, if it contains tests with all numbers from \textbf{1} to \textbf{N}, where \textbf{1} ≤ \textbf{N} ≤ \textbf{99}, and no other files (but there can be sub-directories). The directory is called \textit{a problem}, if it contains the file with name "\textbf{check}" and any (possibly empty) extension and a sub-directory "\textbf{tests}", which is a directory with tests. The directory with a problem can additionally contain other files and sub-directories. The directory is called \textit{the contest description}, if it contains at least one sub-directory, and all its sub-directories are problems. You are given the description of all files stored on a hard drive in Vova's computer. Find out, how many contest descriptions are kept on a hard drive. \InputFile The first line contains the number of files \textbf{n} (\textbf{1} ≤ \textbf{n} ≤ \textbf{1000}). Each of the next \textbf{n} lines contains the full path to the file. Each line contains from \textbf{1} to \textbf{200} characters. The path elements are separated with characters "\textbf{\textbackslash}". At the beginning of the path there is a letter of the drive (from "\textbf{A}" to "\textbf{Z}"), then colon and "\textbf{\textbackslash}". The directory names in the path and the file names consist of characters with codes from \textbf{33} to \textbf{126}, except for the character "\textbf{\textbackslash}". The last element of the path is a full file name. The full file name contains no more than one point. There is at least one character before and after the point. If the file name contains the point, the part of its name after the point is called extension, and the part before the point is called the file name. Otherwise, it is considered that a file has an empty extension, and the file name coincides with its full name. The lowercase and uppercase letters in path do not differ. No directory contains the file and sub-directory with the same name. \OutputFile Print the number of contest descriptions in the given set of files. \textbf{Sample of input and output data} \includegraphics{https://static.e-olymp.com/content/62/62f41ab7ca9409f02ef7290b14724f3dead8864c.jpg}
Time limit 2 seconds
Memory limit 64 MiB
Input example #1
22
C:\olymp\roi2005\aplusb\tests\01
C:\olymp\roi2005\aplusb\tests\01.a
C:\olymp\roi2005\aplusb\tests\02
C:\olymp\roi2005\aplusb\tests\02.a
C:\olymp\roi2005\aplusb\check.exe
C:\olymp\roi2005\gcd\tests\01
C:\olymp\roi2005\gcd\tests\01.a
C:\olymp\roi2005\gcd\tests\02
C:\olymp\roi2005\gcd\tests\02.a
C:\olymp\roi2005\gcd\check.cpp
C:\olymp\roi2005\gcd\solution.exe
C:\olymp\roi2006\aplusb\tests\01
C:\olymp\roi2006\aplusb\tests\01.a
C:\olymp\roi2006\aplusb\tests\03
C:\olymp\roi2006\aplusb\tests\03.a
C:\olymp\roi2006\aplusb\check.exe
C:\olymp\roi2006\gcd\tests\01
C:\olymp\roi2006\gcd\tests\01.a
C:\olymp\roi2006\gcd\tests\03
C:\olymp\roi2006\gcd\tests\02.a
C:\olymp\roi2006\gcd\check.cpp
C:\olymp\roi2006\gcd\solution.exe
Output example #1
1
Author Владимир Ульянцев, Федор Царев