#CCBCHBON0000045. Đếm ký tự đến EOF (Count All Bytes Until EOF)
Đếm ký tự đến EOF (Count All Bytes Until EOF)
Count All Bytes Until EOF
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Read all ASCII input bytes to EOF and count every byte, including whitespace, CR and LF. EOF is a termination signal, not a byte. Empty input yields zero, and an actual final LF is counted.
Input
An ASCII stream of 0..1000000 bytes, optionally with a final LF.
Output
Print the total number of bytes and LF.
Subtasks
-
Subtask 1 (20%): ASCII stream length 0..100 bytes.
-
Subtask 2 (30%): ASCII stream length 0..4000 bytes.
-
Subtask 3 (50%): ASCII stream length 0..1000000 bytes.
Examples
Example 1
Input:
Output:
0
Explanation:
Every byte, including actual spaces and LF, is counted once. Exact input: ""; exact output: "0\n".
Example 2
Input:
ABC
Output:
3
Explanation:
Every byte, including actual spaces and LF, is counted once. Exact input: "ABC"; exact output: "3\n".
Example 3
Input:
A B
Output:
4
Explanation:
Every byte, including actual spaces and LF, is counted once. Exact input: "A B\n"; exact output: "4\n".
Example 4
Input:
Output:
2
Explanation:
Every byte, including actual spaces and LF, is counted once. Exact input: "\n\n"; exact output: "2\n".
Note on displayed bytes: \n denotes an actual LF, \t an actual tab and \r an actual CR. The JSON-style Input renderings in explanations are diagnostic only, not extra input characters.