Problem:
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 and 1.

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

Solution in Java8 (OpenJDK 1.8.0) (judge verdict: Accepted)

import java.util.*;
import java.util.stream.Stream;

public class Main{
	public static void main(String[] args){
		
		
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();   
        int count = 0;
        
        String con = String.valueOf(S);
        String s[] = con.split("");
        int con2[] = Stream.of(s).mapToInt(Integer::parseInt).toArray();

        
        for(int i=0; i<con2.length; i++){
        	if(con2[i] == 1){
        		count++;
        	}
        }
        
    
	   
	   System.out.println(count);
	 }
}