#C95. Count Source Code Files
Count Source Code Files
Count Source Code Files
You are given a list of file paths representing files in a project. Some files are source code files, while others are not. A file is considered a source code file if its extension is one of the following: (.py), (.java), (.cpp), or (.h). File paths may include directories separated by forward slashes (/
). Your task is to count and output the number of source code files.
For example, if the input list contains:
- file1.py
- file2.java
- file3.cpp
- file4.h
- file5.txt
The answer is 4 because only the first four files match one of the required extensions.
inputFormat
The first line of input contains an integer (N) representing the number of file paths. The following (N) lines each contain a single file path.
outputFormat
Output a single integer representing the total count of source code files.## sample
5
file1.py
file2.java
file3.cpp
file4.h
file5.txt
4
</p>