Problem:


暗証番号

新しい暗証番号は覚えにくいものです。メモするのはダメといわれましたが、覚えられそうにありません。そこで文章の中に数値を埋め込んで暗証番号をメモすることにしました。ここでは全ての数値の和が暗証番号になります。

メモされた文章を読み込んで、暗証番号を出力するプログラムを作成してください。

Input

正の整数が埋め込まれた文章が複数行にわたり与えられます。各行は半角英数字、記号、空白を含む文字列または空行です。
ただし、入力は 1 行あたり 80 文字以内で、暗証番号は 10,000 以下であることが保障されています。

Output

暗証番号（文章中の正の整数の合計）を１行に出力します。

Sample Input

Thereare100yenonthetable.Iam17yearsold.
Ishouldgohomeat6pm.

Output for the Sample Input

123



Sample input:
Thereare100yenonthetable.Iam17yearsold.
Ishouldgohomeat6pm.


Sample output:
123

Submission status: Accepted

Solution code:
import re
p=0
while 1:
    try:
        s=input()
    except:break
    for i in re.findall("\d+",s):
        p +=int(i)
print(p)

Submission status: Accepted

Solution code:
num=0
flag=0
seisu=""
while(1):
    try:str=input("")
    except: break
    for moji in str:
        if moji.isdigit():
            seisu=seisu+moji
            flag=1
        elif flag==1:
            flag=0
            num=int(seisu)+num
            seisu=""
print(num)

Submission status: Accepted

Solution code:
sn=[]
while 1:
    try:
        s=input()
        sc=""
        for i in s:
            if 47<ord(i)<58:
                sc+=i
            else:
                sc+=" "
        sn.extend(list(map(int,sc.split())))
    except:break
print(sum(sn))

Submission status: Accepted

Solution code:
text = []
while(1):
    try:
        text.append(input())
    except EOFError:
        break
nums = []
not_nums = {}
for i in text:
    i = [j if j in ["0","1","2","3","4","5","6","7","8","9"] else " " for j in i]
    i = "".join(i)
    [nums.append(int(j)) for j in i.split()]
print(sum(nums))

Submission status: Accepted

Solution code:
import re

pattern = r'([0-9]+)'


sumlist = []
while 1:
    try:
        word = input()
    except EOFError:
        break

    lists = re.findall(pattern, word)

    for l in lists:
        sumlist.append(int(l))

print(sum(sumlist))

Submission status: Accepted

Solution code:
import re

ans = 0
while 1:
    try: s = input()
    except: break
    for i in re.findall('[0-9]+', s):
        ans += int(i)
print(ans)

Submission status: Accepted

Solution code:
import re,sys
a=0
for l in sys.stdin:
    a+=sum(map(int,re.findall(r"\d+",l)))
print(a)

Submission status: Runtime Error

Solution code:
from math import *
PI = 3.1415926535898
ans = 0
while True:
    try:
        s = raw_input()
        t = ""
        for x in s:
            if x.isdigit():
                t += x
            elif len(t) > 0 and t[len(t)-1].isdigit():
                t += " "
        arr = map(int, t.strip().split(' '))
        for x in arr:
            ans += x
    except EOFError:
        break
print ans

Submission status: Runtime Error

Solution code:
import sys

memo = [line.strip() for line in sys.stdin]
at = ""
for i in len(memo):
    for j in len(memo[i]):
        if not memo[i][j].isdigit():
            at += "@"
        else:
            at += str(memo[i][j])
print(sum(at.replace("@", " ").split()))

Submission status: Runtime Error

Solution code:
memo = ""
while True:
    try:
        for s in input():
            memo = memo+s if s.isdigit() else memo+"@"
    except:
        break
print(sum(memo.replace("@", " ").split()))

Submission status: Runtime Error

Solution code:
import sys
memo, ans = [], ""

for line in sys.stdin: memo.append(line.strip())

for me in memo:
    for m in me:
        ans = ans+m if m.isdigit() else ans+"@"
print(sum(ans.replace("@", " ").split()))

Submission status: Runtime Error

Solution code:
ans = ""
while True:
    try:
        memo = input()
    except:
        break
    for m in memo:
        ans = ans+m if m.isdigit() else ans+"@"
print(sum(ans.replace("@", " ").split()))

Submission status: Runtime Error

Solution code:
import re
try:
    ls = num = []
    result = 0
    while True:
        ls.append(input())
except:
    for i in ls:
        for s in range(re.findall(r'\d+', i)):
            result += int(s)
    print(result)

Submission status: Runtime Error

Solution code:
ans = ""
while True:
    try:
        memo = input()
    except:
        break
    for m in memo:
        if m.isdigit()==True:
            ans = ans+m
        else:
            ans = ans+"???"
ans=ans.split()
ans=sum(map(int,ans))
print(ans)

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<string.h>
#include<math.h>

using namespace std;



int main(){
    string in;
    int num=0;
    while(cin>>in){
        bool flag=false;
        int temp = 0;
        for(int i=0; i<in.length(); i++){
            if('0'<=in[i]&&in[i]<='9'){
                temp=temp*10+(in[i]-'0');
                flag=true;
            }else if (flag==true){
                num+=temp;
                temp=0;
                flag=false;
            }
        }
    }
    cout<<num<<endl;
}

Submission status: Runtime Error

Solution code:
import re
print sum(map(int,re.sub("\w+"," ",raw_input()).strip().split()))

Submission status: Runtime Error

Solution code:
import re, sys
print sum(map(int,re.sub("\w+|\s+"," ",sys.stdin.readlines()).strip().split()))

Submission status: Runtime Error

Solution code:
import re, sys
print sum(map(int,re.sub("[^\d]+"," ",sys.stdin.readlines()).strip().split()))

Submission status: Runtime Error

Solution code:
s="".join([s for s in sys.stdin])
p=re.compile('\d+')
x=p.findall(s)
print sum(map(int,x))

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <string>
int main(){
	std::string s,x="";
	while(std::cin>>s)x+=s;
	s="";
	int a=0,i=0;
	for (;i<(int)x.size();i++)
		if (isdigit(x[i])) s+=x[i];
		else
			if (!s.empty()){
				a+=atoi(s.c_str());
				s="";
			}
	std::cout<<a<<"\n";
}