// yukicoder: No.289 数字を全て足そう // 2019.4.14 bal4u #include #include #if 1 #define gc() getchar_unlocked() #else #define gc() getchar() #endif void ins(char *s) // 文字列の入力 スペース以下の文字で入力終了 { do *s = gc(); while (*s++ > ' '); *(s - 1) = 0; } char s[10005], *p = s; int main() { int ans = 0; ins(s); while (*p) { if (isdigit(*p)) ans += *p & 0xf; p++; } printf("%d\n", ans); return 0; }