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 ss.

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 5 5 characters in the title, including 11 uppercase English letter, 11 lowercase English letter, and 22 digit characters, plus 11 space. Since spaces are not counted in the result, the number of valid characters in the title is 44.

Constraints

Let s|s| denote the length of the string ss (that is, the total number of characters and spaces in the string).
For 40%40\% of the testdata, 1s51 \le |s| \le 5, and the input is guaranteed to be digit characters and the end-of-line newline character.
For 80%80\% of the testdata, 1s51 \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%100\% of the testdata, 1s51 \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