#include<iostream>
#include <string.h>
#include <stdio.h>
using namespace std;
int main()
{
long long total;
char num[100000], save[30],i,j;
while (cin.getline(num,100000))
{
total=0;
for (i=0;i<strlen(num);i++)
{
if (num[i]>='0' && num[i]<='9')
{
j=0;
while (num[i]>='0' && num[i]<='9'){
save[j++]=num[i++];
}
total+=atoi(save);
}
}
printf("%d\n",total);
}
return 0;
}
頭尾頭前控格都沒問題啊!
問蛇我也是WA line5: