← 返回 anthropic 的题目列表File Profiler
类型:online_judge
Write a program to analyze features of a given file. The program should be able to:
Count the total number of lines in the file.
Count the total number of words in the file.
Count occurrences of a specific word. The user should specify which word to count.
Compute the size of the file (in bytes).
The output should be:
Total lines
Total words
Occurrences of the specific word
File size
Provide suitable test cases such as an empty file, a file with only one word, or a very large file.
Example
Input
empty.txt with ''