luogu#P5015. [NOIP 2018 普及组] 标题统计
[NOIP 2018 普及组] 标题统计
Background
NOIP 2018 Junior T1.
Problem 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 .
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).
234
3
Ca 45
4
Hint
Sample 1 Explanation
There are 3 characters in the title, and all 3 characters are digit characters.
Sample 2 Explanation
There are characters in the title, including uppercase English letter, lowercase English letter, and digit characters, plus space. Since spaces are not counted in the result, the number of valid characters in the title is .
Constraints
Let denote the length of the string (that is, the total number of characters and spaces in the string).
For of the testdata, , and the input is guaranteed to be digit characters and the end-of-line newline character.
For of the testdata, , and the input may only contain uppercase and lowercase English letters, digit characters, and the end-of-line newline character.
For of the testdata, , and the input may contain uppercase and lowercase English letters, digit characters, spaces, and the end-of-line newline character.
Translated by ChatGPT 5