import re
def Main():
patt=re.compile(r'(\d+)(\+|\-)(\d+)(=)(.*)')
corr=0
try:
while True:
s=input()
s=patt.search(s).groups()
if s[4]=='?':
continue
if s[1]=='+':
if int(s[0])+int(s[2])==int(s[4]):
corr+=1
else:
if int(s[0])-int(s[2])==int(s[4]):
corr+=1
except EOFError:
print(corr)
return 0
if __name__=="__main__":
Main()
def Main():
patt=re.compile(r'(\d+)(\+|\-)(\d+)(=)(.*)')
corr=0
try:
while True:
s=input()
s=patt.search(s).groups()
if s[4]=='?':
continue
if s[1]=='+':
if int(s[0])+int(s[2])==int(s[4]):
corr+=1
else:
if int(s[0])-int(s[2])==int(s[4]):
corr+=1
except EOFError:
print(corr)
return 0
if __name__=="__main__":
Main()
Comments
Post a Comment