問題一覧 > 通常問題

No.289 Let's Add Up All the Digits

レベル : / AI推定難易度 : 98 / 実行時間制限 : 1ケース 1.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 1380
作問者 : yuki2006
お気に入りにしたユーザー ProblemId : 783 / 自分の提出
問題文最終更新日: 2026-06-25 08:18:24
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 123 (順位表) の他の問題:

Problem Statement

Given a string $S$, treat each digit character in it as a single-digit number and find the sum of all of them.
For example, the sum of the digits in the string 1test23 is $1+2+3=6$.

Added 2016/05/31
Note: If there are no digits, output $0$.

Input

$S$

$1 \le |S| \le 10000$
|S| is the length of the string $S$.
The string $S$ consists only of half-width alphanumeric characters.

Output

Output the sum of the digits.

Sample

Sample 1
Input
1test23
Output
6

The answer is $1+2+3=6$.
Note that it is not $1+23$.

Sample 2
Input
2015
Output
8

Sample 3
Input
1a2b3c4d5e6f7g8h90
Output
45

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。