#P1335. 数字游戏(2019)
数字游戏(2019)
Description
小 K 同学向小 P 同学发送了一个长度为 8 的 01 字符串来玩数字游戏,小 P 同学想要知道字符串中究竟有多少个 1。
注意:01 字符串为每一个字符是 0 或者 1 的字符串,如“101”(不含双引号)为一个长度为 3 的 01 字符串。
Input Format
输入文件只有一行,一个长度为 8 的 01 字符串 s。
Output Format
输出文件只有一行,包含一个整数,即 01 字符串中字符 1 的个数。
输入 #1
00010100
输入 #2
11111111
输出 #1
2
输出 #2
8
Hint
【输入输出样例 1 说明】
该 01 字符串中有 <math xmlns="http://www.w3.org/1998/Math/MathML">22 个字符 <math xmlns="http://www.w3.org/1998/Math/MathML">11。
【输入输出样例 2 说明】
该 01 字符串中有 <math xmlns="http://www.w3.org/1998/Math/MathML">88 个字符 <math xmlns="http://www.w3.org/1998/Math/MathML">11。
【数据规模与约定】
- 对于 <math xmlns="http://www.w3.org/1998/Math/MathML">20\%20% 的数据,保证输入的字符全部为 <math xmlns="http://www.w3.org/1998/Math/MathML">00。
- 对于 <math xmlns="http://www.w3.org/1998/Math/MathML">100\%100% 的数据,输入只可能包含字符 <math xmlns="http://www.w3.org/1998/Math/MathML">00 和字符 <math xmlns="http://www.w3.org/1998/Math/MathML">11,字符串长度固定为 <math xmlns="http://www.w3.org/1998/Math/MathML">88。