Time Limit: 2 sec / Memory Limit: 256 MB
配点 : 100 点
問題文
すぬけ君はあるプログラミングコンテストのために、6 問の問題を用意しました。 りんごさんはすぬけ君の用意した各問題についてそれぞれ、プログラミングコンテストに採用するかどうかを決めました。
長さ 6 の文字列 S の i 文字目が 1
ならすぬけ君の用意した i 問目の問題が採用されたことを、0
なら採用されなかったことを表します。
すぬけ君が用意した問題の中で、プログラミングコンテストに採用された問題は何問あるでしょうか。
制約
- S の長さは 6 である
- S は
0
と1
のみからなる
入力
入力は以下の形式で標準入力から与えられる。
S
出力
すぬけ君が用意した問題のうち、プログラミングコンテストに採用された問題の数を出力せよ。
入力例 1
111100
出力例 1
4
1,2,3,4 問目の合計 4 問が採用されました。
入力例 2
001001
出力例 2
2
入力例 3
000000
出力例 3
0
Score : 100 points
Problem Statement
Snuke prepared 6 problems for a upcoming programming contest. For each of those problems, Rng judged whether it can be used in the contest or not.
You are given a string S of length 6.
If the i-th character of s is 1
, it means that the i-th problem prepared by Snuke is accepted to be used; 0
means that the problem is not accepted.
How many problems prepared by Snuke are accepted to be used in the contest?
Constraints
- The length of S is 6.
- S consists of
0
and1
.
Inputs
Input is given from Standard Input in the following format:
S
Outputs
Print the number of problems prepared by Snuke that are accepted to be used in the contest.
Sample Input 1
111100
Sample Output 1
4
The first, second, third and fourth problems are accepted, for a total of four.
Sample Input 2
001001
Sample Output 2
2
Sample Input 3
000000
Sample Output 3
0