Competitive Programming Solutions

GitHub
back to dashboard

E. Count

Codeforces - Sheet #4 (Strings) · limit: 2s · memory: 64MB · view on codeforces

input

351

output

9
Main.java
static void solve() {

        // Write your solution here
        String s = in.next();
        int n = s.length();
        int sum = 0;
        for(int i = 0; i < n; i++){
            sum += (int)(s.charAt(i) - '0');
        }
        out.println(sum);
    }