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: Wrong Answer

Solution code:
import re

st = raw_input()
num = re.compile("\d+")
i = 0
li = []

while 1:
	m = num.search(st, i)
	
	if m:
		s = m.start()
		e = m.end()
		i = e + 1
		li.append(int(st[s:e]))
		print(str(st[s:e]))
	else:
		break

print sum(li)

Submission status: Wrong Answer

Solution code:
import re
st = ""
try:
	while 1:
		st += raw_input()
except:
	pass

num = re.compile("\d+")
i = 0
li = []

while 1:
	m = num.search(st, i)
	
	if m:
		s = m.start()
		e = m.end()
		i = e + 1
		li.append(int(st[s:e]))
		print(str(st[s:e]))
	else:
		break

print sum(li)

Submission status: Wrong Answer

Solution code:
suicide = 0
while True:
    try:
        sentence = raw_input()
        start = None
        last = None
        for index, char in enumerate(sentence):
            if char.isdigit():
                if start == None:
                    start = index
            elif not start == None and not char.isdigit():
                last = index
                suicide += int(sentence[start:last])
                start = None
                last = None
    except EOFError:
        print suicide
        break

Submission status: Wrong Answer

Solution code:
suicide = 0
while True:
    try:
        sentence = raw_input()
        start = None
        last = None
        for index, char in enumerate(sentence):
            if char.isdigit():
                start = index
            elif not start == None and not char.isdigit():
                last = index
                suicide += int(sentence[start:last])
                start = None
                last = None
        else:
            if not start == None:
                suicide += int(sentence[start:])
    except EOFError:
        print suicide
        break

Submission status: Wrong Answer

Solution code:
ans=0
while 1:
    try:
        n=raw_input()
        if n==n[::-1]:
            ans+=1
    except:
        break
print ans

Submission status: Wrong Answer

Solution code:
ans=0
while 1:
    try:
        n=raw_input()
        tmp=''
        for i in n:
            if i.isdigit():
                tmp+=i
            elif len(tmp):
                ans+=int(tmp)
                tmp=''
    except:
        break
print ans

Submission status: Wrong Answer

Solution code:
ans=0
while 1:
    try:
        n=raw_input()
        tmp=''
        for i in n:
            if i.isdigit():
                tmp+=i
            elif len(tmp):
                ans+=int(tmp)
                tmp=''
    except:
        if len(tmp):
            ans+=int(tmp)
            tmp=''
        break
print ans

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys

p = 0
num = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
for line in sys.stdin:
    flag = False
    tmp = 0
    for i in range(len(line)-1):
        if not flag:
            if line[i] in num:
                flag = True
                tmp += int(line[i])
        else:
            if line[i] in num:
                tmp = tmp*10 + int(line[i])
            else:
                flag = False
                p += tmp
                tmp = 0
print p

Submission status: Wrong Answer

Solution code:
nums = list("0123456789")
res = 0
while True:
    try:
        cc = list(input())
        if not len(cc):
            break
    except:
        break
    s = 0
    t = []
    for c in cc:
        if c in nums:
            t.append(c)
        else:
            if t != []:
                s += int("".join(t))
                t = []
    if t != []:
        s += int("".join(t))
    res += s
print(res)

Submission status: Wrong Answer

Solution code:
numbers = ["0","1","2","3","4","5","6","7","8","9"]
a = 0
while True:
  try:
    l = [s for s in input()]
  except:
    break
  b = 0
  for s in l:
    if s in numbers:
      b *= 10
      b += int(s)
    else:
      if b != 0:
        a += b
        b = 0
print(a)

Submission status: Wrong Answer

Solution code:
numbers = ["0","1","2","3","4","5","6","7","8","9"]
a = 0
b = 0
while True:
  try:
    l = [s for s in input()]
  except:
    a += b
    break
  b = 0
  for s in l:
    if s in numbers:
      b *= 10
      b += int(s)
    else:
      if b != 0:
        a += b
        b = 0
print(a)

Submission status: Wrong Answer

Solution code:
import re

l=0
try:
 while True:
  x=input()
  for i in re.findall(r'\d+',x):
      lst+=int(i)
except:
   print(l)

Submission status: Wrong Answer

Solution code:
dict = "abcdefghijklmnopqrstuvwxyz,.'"
pas = 0
while True:
    try:
        a = raw_input()
        s = ""
        for i in a:
            if dict.count(i) == 0:
                s += i
            else:
                pas += int(s)
                s = ""
    except:
        break
print pas

Submission status: Wrong Answer

Solution code:
dict = "abcdefghijklmnopqrstuvwxyz,.'"
pas = 0
while True:
    try:
        a = raw_input().lower()
        s = ""
        for i in a:
            if dict.count(i) == 0:
                s += i
            else:
                pas += int(s)
                s = ""
    except:
        break
print pas

Submission status: Wrong Answer

Solution code:
dict = "1234567890"
pas = 0
while True:
    try:
        a = raw_input()
        s = "0"
        for i in a:
            if dict.count(i) > 0:
                s += i
            else:
                pas += int(s)
                s = "0"
            print pas
    except:
        break
print pas

Submission status: Wrong Answer

Solution code:
dict = "1234567890"
pas = 0
while True:
    try:
        a = raw_input()
        s = "0"
        for i in a:
            if dict.count(i) > 0:
                s += i
            else:
                pas += int(s)
                s = "0"
    except:
        break
print pas

Submission status: Wrong Answer

Solution code:
sm = 0
try:
    while True:
        s = raw_input()
        ix = -1
        for i, c in enumerate(s):
            if ix == -1 and c.isdigit():
                ix = i
            if ix != -1 and not c.isdigit():
                sm += int(s[ix:i])
                ix = -1
except EOFError:
    pass
print sm

Submission status: Accepted

Solution code:
ans = 0
nums = [str(i) for i in range(10)]
while True:
  try:
    s = input()
    acc = 0
    last_ind = -1
    for i, c in enumerate(s):
      if c in nums:
        if last_ind == i - 1:
          acc *= 10
          acc += int(c)
        else:
          acc = int(c)
        last_ind = i
      else:
        ans += acc
        acc = 0
    else:
      ans += acc
  except EOFError:
    break
print(ans)

Submission status: Accepted

Solution code:
import sys,re
print(sum(map(int,re.findall(r"\d+",sys.stdin.read()))))

Submission status: Accepted

Solution code:
import sys
import re


num = 0
for s in sys.stdin:
    num += sum( [ int(n) for n in re.findall(r"[0-9]+",s) ] )
print num

Submission status: Accepted

Solution code:
import sys
f = sys.stdin

import string
secret = 0
for line in f:
    line = list(line)
    for i in range(len(line)):
        if line[i] not in string.digits:
            line[i] = ' '
    secret += sum(map(int, ''.join(line).split()))
print(secret)

Submission status: Accepted

Solution code:
import re
st = ""
try:
	while 1:
		st += raw_input()
except:
	pass

num = re.compile("\d+")
i = 0
li = []

while 1:
	m = num.search(st, i)
	
	if m:
		s = m.start()
		e = m.end()
		i = e + 1
		li.append(int(st[s:e]))
	else:
		break

print sum(li)

Submission status: Accepted

Solution code:
suicide = 0
while True:
    try:
        sentence = raw_input()
        start = None
        last = None
        for index, char in enumerate(sentence):
            if char.isdigit():
                if start == None:
                    start = index
            elif not start == None and not char.isdigit():
                last = index
                suicide += int(sentence[start:last])
                start = None
                last = None
        else:
            if not start == None:
                suicide += int(sentence[start:])
    except EOFError:
        print suicide
        break

Submission status: Accepted

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 += " "
        if len(t) > 0:
            arr = map(int, t.strip().split(' '))
            for x in arr:
                ans += x
    except EOFError:
        break
print ans

Submission status: Accepted

Solution code:
ans=0
while 1:
    try:
        n=raw_input()
        tmp=''
        for i in n:
            if i.isdigit():
                tmp+=i
            elif len(tmp):
                ans+=int(tmp)
                tmp=''
        if len(tmp):
            ans+=int(tmp)
            tmp=''
    except:
        break
print ans

Submission status: Accepted

Solution code:
import re

sn = 0

while True:
    try:
        s = input().strip()
    except EOFError:
        break

    sn += sum(map(int, re.findall('\d+', s)))

print(sn)

Submission status: Accepted

Solution code:

import sys

ans ,flag, num = 0, 0, []
for line in sys.stdin:
    word = line[:-1]
    for j in xrange(len(word)):
        try: 
            int(word[j])
            num.append(word[j])
            flag = 1 
        except:
            if flag == 1:
                ans += int("".join(num))
                num = []
                flag = 0
            else: pass
print ans

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys

p = 0
num = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
for line in sys.stdin:
    flag = False
    tmp = 0
    for i in range(len(line)-1):
        if not flag:
            if line[i] in num:
                flag = True
                tmp += int(line[i])
        else:
            if line[i] in num:
                tmp = tmp*10 + int(line[i])
            else:
                flag = False
                p += tmp
                tmp = 0
    if flag:
        p += tmp
        tmp = 0
print p

Submission status: Accepted

Solution code:
import re
ans = 0
while True:
    try:
        s = input()
    except EOFError:
        break
    ans+=sum(map(int,re.findall('\d+',s)))
print(ans)

Submission status: Accepted

Solution code:
s=""
li=[str(i) for i in xrange(10)]
while 1:
    try:
        s+=raw_input()
    except:
        ans=0
        num=""
        for i in s:
            if i in li:
                num+=i
            else:
                if num!="":
                    ans+=int(num)
                    num=""
        print(ans)
        break

Submission status: Accepted

Solution code:
nums = list("0123456789")
res = 0
while True:
    try:
        cc = list(input())
    except:
        break
    s = 0
    t = []
    for c in cc:
        if c in nums:
            t.append(c)
        else:
            if t != []:
                s += int("".join(t))
                t = []
    if t != []:
        s += int("".join(t))
    res += s
print(res)

Submission status: Accepted

Solution code:
numbers = ["0","1","2","3","4","5","6","7","8","9"]
a = 0
b = 0
while True:
  try:
    l = [s for s in input()]
  except:
    break
  b = 0
  for s in l:
    if s in numbers:
      b *= 10
      b += int(s)
    else:
      if b != 0:
        a += b
        b = 0
  if b != 0:
    a += b
print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
u = 0
while True:
    try:
        s = input()
        t = re.sub(r'[^0-9]+', ' ', s).split()
        u += sum(map(int, t))
    except EOFError:
        break

print(u)

Submission status: Accepted

Solution code:
ans = 0
while True:
    try:
        S = input()
    except EOFError:
        break
    cnt = 0
    for i in S:
        if i.isdigit():
            cnt = cnt * 10 + int(i)
        else:
            ans += cnt
            cnt = 0
    ans += cnt

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys
import os
import re

def extract_numbers(s):
    lst = re.findall('[0-9]+', s)
    return list(map(int, lst))

sum_value = 0
for s in sys.stdin:
    s = s.strip()
    lst = extract_numbers(s)
    sum_value += sum(lst)
print(sum_value)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re

lst=0
try:
 while True:
  x=input()
  for i in re.findall(r'\d+',x):
      lst+=int(i)
except:
   print(lst)

Submission status: Accepted

Solution code:
import re

l=0
try:
 while True:
  x=input()
  for i in re.findall(r'\d+',x):
      l+=int(i)
except:
   print(l)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0064
"""

import sys


def parse_line(txt):
    txt = txt + '@'
    total = 0
    buff = []
    for c in txt:
        if c.isdigit():
            buff.append(c)
        else:
            if len(buff):
                total += int(''.join(buff))
                buff = []
    return total


def main(args):
    total = 0
    for line in sys.stdin:
        total += parse_line(line.strip())

    # ?????????????¨?
    print(total)

if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
# Aizu Problem 0064: Secret Number
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


N = 0
while True:
    try:
        string = input().strip()
    except EOFError:
        break
    string = ''.join([s if '0' <= s <= '9' else ' ' for s in string ])
    for k in string.split():
        N += int(k)
print(N)

Submission status: Accepted

Solution code:
import re
ans = 0
while True:
    try:
        line = input()
    except:
        print(ans)
        break
    ans += sum(map(int, re.findall("[0-9]+", line)))

Submission status: Accepted

Solution code:
import re
ans = 0
while True:
    try:
        s = input()
        ans += sum(map(int,re.findall('\d+',s)))
    except:
        print(ans)
        break

Submission status: Accepted

Solution code:
def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

N = list(get_input())
ans = 0
for l in range(len(N)):
    S = "x" + N[l]
    for i in range(len(S)):
        if S[i].isdigit() and not(S[i-1].isdigit()):
            d = int(S[i])
            for j in range(i+1, len(S)):
                if S[j].isdigit():
                    d = d*10 + int(S[j])
                else:
                    break
            ans += d
print(ans)

Submission status: Accepted

Solution code:
import re,sys
print(sum([sum(map(int,re.sub("\D", " ", e).split()))for e in sys.stdin]))

Submission status: Accepted

Solution code:
import sys
print(sum(map(int,''.join([' ',c][c.isdigit()]for e in sys.stdin for c in e).split())))

Submission status: Accepted

Solution code:
import sys,re
print(sum([sum(map(int,re.findall(r"[0-9]{1,5}",i))) for i in [j for j in sys.stdin]]))

Submission status: Accepted

Solution code:
# AOJ 0064: Secret Number
# Python3 2018.6.15 bal4u

ans = k = 0
while True:
	try:
		s = list(input())
		for i in range(len(s)):
			if '0' <= s[i] <= '9': k = 10*k + int(s[i])
			else:
				ans += k
				k = 0
	except EOFError:
		break
print(ans+k)

Submission status: Accepted

Solution code:
# AOJ 0064: Secret Number
# Python3 2018.6.20 bal4u

import re
ans = 0
while True:
	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
nn=re.compile("\D")
total=0
for line in sys.stdin.readlines():
    result=nn.split(line.strip())
    total+=sum(map(int,[x for x in result if not x==""]))
print total
#temp

Submission status: Accepted

Solution code:

import sys
import re


def solv(s):
    r = re.compile("\d+")
    ns = r.findall(s)
    ns = map(int, ns)
    return sum(ns)


s = sys.stdin.read()
print solv(s)

Submission status: Accepted

Solution code:
import sys,re
print sum(map(int,re.findall("\d+",sys.stdin.read())))

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

s = 0
digit = bytearray()
c = stdin.read(1)
while c:
    if c.isdigit():
        digit.append(c)
    elif digit:
        s += int(digit)
        digit = bytearray()
    c = stdin.read(1)

print(s)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

s = 0
for line in stdin:
    digit = bytearray()
    for c in line:
        if c.isdigit():
            digit.append(c)
        elif digit:
            s += int(digit)
            digit = bytearray()

print(s)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

s = 0
for line in stdin:
    n = 0
    for c in line:
        if c.isdigit():
            n = n * 10 + int(c)
        elif n:
            s += n
            n = 0

print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
y=0
for s in sys.stdin:
    x=""
    for c in s:
        if c.isdigit():x+=c
        elif x!="":
            y+=int(x)
            x=""
print y

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
dict = "1234567890"
pas = 0
for a in sys.stdin:
    s = "0"
    for i in a:
        if dict.count(i) > 0:
            s += i
        else:
            pas += int(s)
            s = "0"
print pas

Submission status: Accepted

Solution code:
import re, sys
ans = 0
for s in sys.stdin.readlines():
    ans += sum(map(int, re.findall('[0-9]+', s)))
print ans

Submission status: Accepted

Solution code:
import re

sum = 0
while True:
  try:
    str = raw_input()
    r = re.compile(r'[0-9]+')
    arr = r.findall(str)
    for a in arr:
      sum += int(a)
  except:
    break

print sum

Submission status: Accepted

Solution code:
sm = 0
try:
    while True:
        a = ''
        for c in raw_input():
            a += c if c.isdigit() else ' '
        sm += sum(map(int, a.split()))
except EOFError:
    pass
print sm

Submission status: Accepted

Solution code:
import re

ret = 0
while 1:
    try:
        line = raw_input()
    except EOFError:
        break
    num_match = re.findall('\d+', line)
    ret += sum(map(int, num_match))
print ret

Submission status: Accepted

Solution code:
import re
password = 0
while True:
    try:
        s = input()
    except EOFError:
        break

    for n in re.findall('[0-9]+', s):
        password += int(n)

print(password)

Submission status: Accepted

Solution code:
ans = 0
while True:
    try:
        a = input()
    except EOFError:
        break
    cnt = 0
    for i in a:
        if i.isdigit():
            cnt = cnt * 10 + int(i)
        else:
            ans += cnt
            cnt = 0
    ans += cnt

print(ans)

Submission status: Accepted

Solution code:
c=[]
import re
while True:
    try:
        a = input()
        b = re.findall(r"\d+", a)
        b = list(map(int, b))
        c.append(sum(b))
    except:
        break
print(sum(c))

Submission status: Accepted

Solution code:
import re
a=0
while True:
    try:
        s=str(input())
    except EOFError:
        break
    for i in re.findall("[0-9]+",s):
        a+=int(i)
print(a)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import re
S=0
while True:
    try:
        x=input()
        R=re.compile("\d+")
        m=R.findall(x)
        M=[int(s) for s in m]
        S+=sum(M)
    except EOFError:
        break
print(S)

Submission status: Accepted

Solution code:
import re
regex=re.compile("\d+")
i=0
while True:
    try:
        n=input()
        kazu=regex.findall(n)
        for k in range(len(kazu)):
            i+=int(kazu[k])
        
        
    except EOFError:
        print(i)
        break

Submission status: Accepted

Solution code:
import re
s=0
while True:
    try:
        n=input()
    except:
        break
    for i in re.findall("[0-9]+",n):
        s+=int(i)
print(s)

Submission status: Accepted

Solution code:
import re
sum=0
while True:
    try:
        angou=input()
        suji=re.findall('[0-9]+',angou)
        suji=[int(i) for i in suji]
        for i in range(len(suji)):
            sum+=suji[i]
    except EOFError:
        break
print(sum)

Submission status: Accepted

Solution code:
import re
l=[]

while True:
    try:
        n=input()
        m=re.findall(r"\d+", n)
        l.extend(m)
    except:
        break

for i in range(len(l)):
    l[i]=int(l[i])
print(sum(l))

Submission status: Accepted

Solution code:
import re
S=0
while True:
    try:
        x=input()
        R=re.compile("\d+")
        m=R.findall(x)
        M=[int(s) for s in m]
        S+=sum(M)
    except EOFError:
        break
print(S)

Submission status: Accepted

Solution code:
num=[]
while True:
    try:
        s=list(str(input()))
        i=0
        while True:
            if i>=len(s):
                break
            if s[i].isnumeric()==True:
                try:
                    if s[i+1].isnumeric()==True:
                        try:
                            if s[i+2].isnumeric()==True:
                                try:
                                    if s[i+3].isnumeric()==True:
                                        try:
                                            if s[i+4].isnumeric()==True:
                                                num.append(int(s[i]+s[i+1]+s[i+2]+s[i+3]+s[i+4]))
                                                i+=5
                                            else:
                                                num.append(int(s[i]+s[i+1]+s[i+2]+s[i+3]))
                                                i+=4
                                        except IndexError:
                                            num.append(int(s[i]+s[i+1]+s[i+2]+s[i+3]))
                                            i+=4
                                    else:
                                        num.append(int(s[i]+s[i+1]+s[i+2]))
                                        i+=3
                                except IndexError:
                                    num.append(int(s[i]+s[i+1]+s[i+2]))
                                    i+=3
                            else:
                                num.append(int(s[i]+s[i+1]))
                                i+=2
                        except IndexError:
                            num.append(int(s[i]+s[i+1]))
                            i+=2
                    else:
                        num.append(int(s[i]))
                        i+=1
                except IndexError:
                    num.append(int(s[i]))
                    i+=1
            else:
                i+=1
    except EOFError:
        break
print(sum(num))

Submission status: Accepted

Solution code:
import re

S=[]
while True:
    try:
        n = input()
    except EOFError:
        break
    
    num = re.findall(r"\d+", n)
    num = [int(i) for i in num]
    s = sum(num)
    S.append(s)
        
print(sum(S))

Submission status: Accepted

Solution code:
import re
sentences = []
while True:
    try:
        sentences.append(input())
    except:
        break

ans = 0
for sentence in sentences:
    ans += sum(map(int, re.findall(r"\d+", sentence)))
print(ans)

Submission status: Accepted

Solution code:
import re
S = 0
try:
   while True:
      x = input()
      s = re.findall(r'\d+', x)
      for i in range(len(s)):
         S += int(s[i])
except EOFError:
   pass
print(S)

Submission status: Accepted

Solution code:

import re
ans = 0

while 1:
    try:
        a = input()
        num = re.findall("[0-9]+",a)
        for i in range(len(num)):
            ans += int(num[i])
            
    except:
        print(ans)
        break

Submission status: Accepted

Solution code:
import re
M=0
L=[]

try:
    while True:
        A=str(input())
        L.append(re.findall('[0-9]+', A))
        
except EOFError:
    pass

B=len(L)
for i in range(B):
    C=len(L[i])
    D=L[i]
    for j in range(C):
        M+=int(D[j])
print(M)

Submission status: Accepted

Solution code:
import re

s_s = []

while True:
    try:
        d = input()
        reg = re.compile('\d+')

        for line in d.splitlines():
            ma = reg.findall(line)
        
        ma_int = [int(n) for n in ma]
        
        s = sum(ma_int)
        s_s.append(s)
        
    except EOFError:
        break

print(sum(s_s))

Submission status: Accepted

Solution code:
ans = 0
while True:
    try:
        s = list(input())
        numlst = []
        anslst = []

        for num, i in enumerate(s):
            try:
                k = int(i)
                numlst.append(num)

            except:
                pass
        
        for i in range(len(numlst)-1):
            if numlst[i+1] - numlst[i] == 1:
                s[numlst[i+1]] = s[numlst[i]] + s[numlst[i+1]]
            else:
                anslst.append(numlst[i])

        if numlst !=[]:
            anslst.append(numlst[-1])
        
        for i in anslst:
            ans = ans + int(s[i])

    except EOFError:
        break

print(ans)

Submission status: Accepted

Solution code:
a = []
import re
while True:
    try:
        s = input()
        r = re.findall(r'[0-9]+',s)
        l = len(r)
        for i in range(l):
            a.append(r[i])
    except:
        break

a = [int(i) for i in a]
print(sum(a))

Submission status: Accepted

Solution code:
#0064
import re
l = []
while True:
    try:
        word = input()
    except:
        break
    regex = re.compile('\d+')
    for line in word.splitlines():
        match = regex.findall(line)
    for i in match:
        l.append(int(i))
print(sum(l))

Submission status: Accepted

Solution code:
import re
ans = 0
while True:
    try:
        a = input()
        a= re.findall('\d+',a)
        a = map(int,a)
        a = sum(a)
        ans += a
    except:
        break

print(ans)

Submission status: Accepted

Solution code:
import re
c=0
while True:
    try:
        X=input()
        n=re.findall(r'\d+',X)
        for i in range(len(n)):
            c+=int(n[i])
    except:
        break
print(c)

Submission status: Accepted

Solution code:
import re
a = 0
while 1:
    try:
        n = input()
    except:
        break
    for i in re.findall('[0-9]+',n):
        a += int(i)
print(a)

Submission status: Accepted

Solution code:
import re
s = 0

while True :
    try :
        text = input()
    except EOFError :
        break

    regex = re.compile('\d+')

    for line in text.splitlines():
        match = regex.findall(line)
    
    
    for i in range(len(match)) :
        s += int(match[i])
print(s)

Submission status: Accepted

Solution code:
import re

SUM = 0
while True:
    try:
        text = input()
        while True:
            try:
                pattern = '.*?(\d+)'
                result = re.match(pattern, text)
                SUM += int(result.group(1))
                
                textlist = list(text)
                i = text.find(str(result.group(1)))
                del(textlist[0:i+len(str(result.group(1)))])
                text = ''.join(textlist)
            except:
                break
        continue
    except:
        break
print(SUM)

Submission status: Accepted

Solution code:
import re

ans = 0

while True :
    try :
        s = input()

        num = re.findall("[0-9]+", s)
        
        for i in range(len(num)) :
            ans += int(num[i])
            
    except :
        print(ans)
        break

Submission status: Accepted

Solution code:
import re
y=0
while True:
    try:
        n=input()
    except:
        break
    y+=sum(map(int,re.findall('\d+',n)))
print(y)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re


password=0
while True:
    try:
        str=input()

        str=re.sub("[^\d]"," ",str)
        str=re.sub("\s+"," ",str)
        for i in str.split(" "):
            try:
                password+=int(i)
            except ValueError:
                pass


    except EOFError:
        break

print(password)

Submission status: Accepted

Solution code:
import re
c = 0
while True:
    try:
        s = input()
        c += sum( [int(x) for x in re.sub("[^0-9]", " ", s).split()] )
    except:
        break

print(c)

Submission status: Accepted

Solution code:
import re
a = []
while 1:
    try:
        text = input()
        a.extend(re.findall(r'\d+', text))
    except:
        break

a = [int(i) for i in a]
print(sum(a))

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    
    ans = 0
    while True:
        try:
            line = list(input())
            tmp = ""
            for i in line:
                if i.isdigit():
                    tmp += i
                else:
                    if len(tmp) >= 1:
                        ans += int(tmp)
                        tmp = ""
            if len(tmp) >= 1:
                ans += int(tmp)

        except EOFError:
            break

    print(ans)