#include #include #include #include int main(void) { char *s; int total = 0; int i; s = malloc(10000 * sizeof(char)); if (*s == NULL) { printf("記憶域の確保に失敗しました。"); } else { scanf("%s", s); for (i = 0; i < strlen(s); i++) if (isdigit(s[i])) total += s[i] - '0'; printf("%d\n", total); free(s); } return 0; }