P5015 [NOIP 2018 Junior] Title Statistics
Background
NOIP 2018 Junior T1.
Description
Kaikai has just written a wonderful essay. How many characters are there in the title of this essay? Note: The title may contain uppercase and lowercase English letters, digit characters, spaces, and newline characters. When counting the number of title characters, spaces and newline characters are not included.
Input Format
The input file contains only one line: a string $s$.
Output Format
The output file contains only one line, containing an integer, which is the number of characters in the essay title (excluding spaces and newline characters).
Explanation/Hint
**Sample 1 Explanation**
There are 3 characters in the title, and all 3 characters are digit characters.
**Sample 2 Explanation**
There are $ 5$ characters in the title, including $1$ uppercase English letter, $1$ lowercase English letter, and $2$ digit characters, plus $1$ space. Since spaces are not counted in the result, the number of valid characters in the title is $4$.
**Constraints**
Let $|s|$ denote the length of the string $s$ (that is, the total number of characters and spaces in the string).
For $40\%$ of the testdata, $1 \le |s| \le 5$, and the input is guaranteed to be digit characters and the end-of-line newline character.
For $80\%$ of the testdata, $1 \le |s| \le 5$, and the input may only contain uppercase and lowercase English letters, digit characters, and the end-of-line newline character.
For $100\%$ of the testdata, $1 \le |s| \le 5$, and the input may contain uppercase and lowercase English letters, digit characters, spaces, and the end-of-line newline character.
Translated by ChatGPT 5