#P5660. [CSP-J 2019] 数字游戏
[CSP-J 2019] 数字游戏
Problem Description
Student K sent Student P a 01 string of length to play a number game. Student P wants to know how many ’s are in the string.
Note: A 01 string is a string where every character is or . For example, 101 is a 01 string of length .
Input Format
The input file contains only one line: a 01 string of length .
Output Format
The output file contains only one line containing an integer, which is the number of character in the 01 string.
00010100
2
11111111
8
Hint
Sample 1 Explanation
There are characters in this 01 string.
Sample 2 Explanation
There are characters in this 01 string.
Constraints
- For of the testdata, all input characters are guaranteed to be .
- For of the testdata, the input can only contain character and character , and the string length is fixed at .
Translated by ChatGPT 5