Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import re
c=0
for x in re.sub(r'..\..*?:','',input()).replace(' ','').split(','):
 y=x.split('-')
 if len(y)<2:c+=1
 else:
	a,b=y[0],y[1];d=int(re.sub('[A-z]','',b))-int(a)+1
	if b[-1]>':':d=d/2+d%2*(int(a)%2==ord(b[-3])%2)
	c+=d
print c

# 'pg. 546: 17-19, 22, 26, pg. 548: 35-67 odd, 79, 80-86 even'
# 'pg. 34: 1'
# 'PG. 565: 2-5,PG.345:7'
# 'pg. 343: 5,8,13 - 56 even,pg. 345: 34 - 78,80'

# 'pg.492: 2-4 odd,7-9 even'