You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
557 B
29 lines
557 B
#!/usr/bin/env python3
|
|
|
|
from sys import argv
|
|
|
|
i = [x for x in open(argv[1])]
|
|
|
|
ok = 0
|
|
ok2 = 0
|
|
|
|
for l in i:
|
|
req = l.split(": ")[0]
|
|
nums = req.split(" ")[0]
|
|
s = int(nums.split("-")[0])
|
|
e = int(nums.split("-")[1])
|
|
let = req.split(" ")[1]
|
|
pwd = l.split(": ")[1]
|
|
|
|
c = 0
|
|
for i, ch in enumerate(pwd):
|
|
if ch == let:
|
|
if i + 1 == s or i + 1 == e:
|
|
p2 += 1
|
|
c += 1
|
|
if c >= s and c <= e:
|
|
ok += 1
|
|
if (pwd[s-1] == let) ^ (pwd[e-1] == let):
|
|
ok2 += 1
|
|
print(ok)
|
|
print(ok2)
|
|
|