import re

re_entry = re.compile(r'((?:[0-9]+))-((?:[0-9]+))\s(\S)\:\s(\S*)')

valid_passwords = 0

try:
    while True:
        entry = input()
        match = re_entry.match(entry)
        c_min, c_max, c, password = list(match.groups())

        c_count = password.count(c)
        if int(c_min) <= c_count and c_count <= int(c_max):
            valid_passwords += 1
except EOFError:
    pass

print(valid_passwords)

a7490be7b8d37d23e1835d5dad032da0aaef5166
<mask token>

<mask token>
try:
    while True:
        entry = input()
        match = re_entry.match(entry)
        c_min, c_max, c, password = list(match.groups())
        c_count = password.count(c)
        if int(c_min) <= c_count and c_count <= int(c_max):
            valid_passwords += 1
except EOFError:
    pass
print(valid_passwords)

<mask token>
re_entry = re.compile('((?:[0-9]+))-((?:[0-9]+))\\s(\\S)\\:\\s(\\S*)')
valid_passwords = 0
try:
    while True:
        entry = input()
        match = re_entry.match(entry)
        c_min, c_max, c, password = list(match.groups())
        c_count = password.count(c)
        if int(c_min) <= c_count and c_count <= int(c_max):
            valid_passwords += 1
except EOFError:
    pass
print(valid_passwords)

import re
re_entry = re.compile('((?:[0-9]+))-((?:[0-9]+))\\s(\\S)\\:\\s(\\S*)')
valid_passwords = 0
try:
    while True:
        entry = input()
        match = re_entry.match(entry)
        c_min, c_max, c, password = list(match.groups())
        c_count = password.count(c)
        if int(c_min) <= c_count and c_count <= int(c_max):
            valid_passwords += 1
except EOFError:
    pass
print(valid_passwords)

import re

re_entry = re.compile(r'((?:[0-9]+))-((?:[0-9]+))\s(\S)\:\s(\S*)')

valid_passwords = 0

try:
    while True:
        entry = input()
        match = re_entry.match(entry)
        c_min, c_max, c, password = list(match.groups())

        c_count = password.count(c)
        if int(c_min) <= c_count and c_count <= int(c_max):
            valid_passwords += 1
except EOFError:
    pass

print(valid_passwords)
