P5660 [CSP-J 2019] Number Game
Description
Student K sent Student P a **01 string** of length $8$ to play a number game. Student P wants to know how many $1$’s are in the string.
Note: A 01 string is a string where every character is $0$ or $1$. For example, `101` is a 01 string of length $3$.
Input Format
The input file contains only one line: a 01 string $s$ of length $8$.
Output Format
The output file contains only one line containing an integer, which is the number of **character $\mathbf 1$** in the 01 string.
Explanation/Hint
**Sample 1 Explanation**
There are $2$ characters $1$ in this 01 string.
**Sample 2 Explanation**
There are $8$ characters $1$ in this 01 string.
**Constraints**
- For $20\%$ of the testdata, all input characters are guaranteed to be $0$.
- For $100\%$ of the testdata, the input can only contain character $0$ and character $1$, and the string length is fixed at $8$.
Translated by ChatGPT 5