1167: [CSP-J2019] 数字游戏

文件提交:无需freopen 内存限制:128 MB 时间限制:1.000 S
评测方式:普通裁判 命题人:
提交:1 解决:1

题目描述

小 K 同学向小 P 同学发送了一个长度为 lns="http://www.w3.org/1998/Math/MathML">8 的 01 字符串来玩数字游戏,小 P 同学想要知道字符串中究竟有多少个 lns="http://www.w3.org/1998/Math/MathML">1

注意:01 字符串为每一个字符是 lns="http://www.w3.org/1998/Math/MathML">0 或者 lns="http://www.w3.org/1998/Math/MathML">1 的字符串,如“101”(不含双引号)为一个长度为 lns="http://www.w3.org/1998/Math/MathML">3 的 01 字符串。

输入

输入文件只有一行,一个长度为 lns="http://www.w3.org/1998/Math/MathML">8 的 01 字符串 lns="http://www.w3.org/1998/Math/MathML">

输出

输出文件只有一行,包含一个整数,即 01 字符串中字符 lns="http://www.w3.org/1998/Math/MathML">1 的个数。

样例输入

00010100

样例输出

2

提示

【输入输出样例 1 说明】

该 01 字符串中有 lns="http://www.w3.org/1998/Math/MathML">2 个字符 lns="http://www.w3.org/1998/Math/MathML">1

【输入输出样例 2 说明】

该 01 字符串中有 lns="http://www.w3.org/1998/Math/MathML">8 个字符 lns="http://www.w3.org/1998/Math/MathML">1

来源/分类