کد
"""
----input
2
----output
Woow!
"""
n = int(input())
print("W","o"*n,"w!", sep="")3537 - سوال زرد"""
----input
2
----output
Woow!
"""
n = int(input())
print("W","o"*n,"w!", sep="")2885 - سوال ساده"""
----input
2
----output
man khoshghlab hastam
man khoshghlab hastam
"""
n = int(input())
text = "man khoshghlab hastam\n"
print((text * n).strip())
# for i in range(n):
# print("man khoshghlab hastam")2636 - شطرنج حرفهای"""
----input
0 2 2 2 3 7
----output
1 -1 0 0 -1 1
"""
x = input().split(" ")
print(
1 - int(x[0]),
1 - int(x[1]),
2 - int(x[2]),
2 - int(x[3]),
2 - int(x[4]),
8 - int(x[5])
)615 - تاریخ تولد"""
----input
7106
----output
saal:71
maah:06
----input
7011
----output
saal:70
maah:11
----input
0012
----output
saal:00
maah:12
"""
yymm = input()
print("saal:",yymm[0:2])
print("maah:", yymm[2:4])8838 - کمک به کاپی"""
----input
2 shoma
----output
copy of copy of shoma
"""
n_text = input()
n, text = n_text.split(" ")
print("copy of " * int(n) + text)3429 - یخدارچی"""
----input
110
----output
Steam
----input
100
----output
Water
----input
-200
----output
Ice
"""
n = int(input())
if n < 0:
print("Ice")
elif n > 100:
print("Steam")
else:
print("Water")10162 - روز آزادی بیان در برره"""
----input
1
----output
Payin Barare
----input
74
----output
Bala Barare
"""
print("Bala Barare" if int(input()) % 2 == 0 else "Payin Barare")280 - اعداد فیثاغورثی"""
----input
3
4
5
----output
YES
"""
a, b, c = int(input()), int(input()), int(input())
if a == 0 or b == 0 or c == 0:
print("NO")
elif a*a+b*b==c*c or a*a+c*c==b*b or c*c+b*b==a*a:
print("YES")
else:
print("NO")10230 - مشق امشب باقر"""
----input
70 60 50
----output
Yes
----input
180 0 0
----output
No
----input
150 40 10
----output
No
"""
angles = input()
a1, a2, a3 = angles.split(" ")
a1 = int(a1)
a2 = int(a2)
a3 = int(a3)
if a1 == 0 or a2 == 0 or a3 == 0:
print("No")
elif a1 + a2 + a3 != 180:
print("No")
else:
print("Yes")3406 - صدگان خسته"""
----input
123
421
----output
421 < 123
----input
123
123
----output
123 = 123
----input
201
800
----output
800 < 201
"""
x = input()
y = input()
if x[2] < y [2]:
print(x, "<", y)
elif x[2] > y [2]:
print(y, "<", x)
else:
if x[1] < y [1]:
print(x, "<", y)
elif x[1] > y [1]:
print(y, "<", x)
else:
if x[0] < y [0]:
print(x, "<", y)
elif x[0] > y [0]:
print(y, "<", x)
else:
print(x, "=", y)51865 - بهداشت و سلامت"""
----input
14
0
----output
20
----input
6
7
----output
6
----input
13
9
----output
4
"""
score = int(input())
days = int(input())
if days == 0:
print(20)
elif days == 7:
print(score)
else:
final = score - days
if final > 0:
print(final)
else:
print(0)10325 - همایش زندگی بهتر"""
----input
1 1
----output
Right 10 1
----input
4 15
----output
Left 7 6
"""
r, c = input().split(" ")
r = int(r)
c = int(c)
d = "Right" if c <= 10 else "Left"
a = 11 - r
b = c if c <= 10 else 21 - c
print(d, a, b)9774 - عدد چاپکن"""
----input
50943
----output
5: 55555
0:
9: 999999999
4: 4444
3: 333
"""
digits = input()
for i in digits:
print(i + ":", i * int(i))17244 - شارژ موبایل"""
----input
1
----output
1
----input
3
----output
6
"""
k = int(input())
time = 0
for i in range(k):
time += i + 1
print(time)589 - فاکتوریل"""
----input
5
----output
120
"""
n = int(input())
n_fact = 1
for i in range(1, n+1):
n_fact *= i
print(n_fact)3409 - جدول ضرب گنده"""
----input
3
----output
1 2 3
2 4 6
3 6 9
"""
n = int(input())
for i in range(1, n+1):
for j in range(1, n+1):
print(i*j, end=" ")
print()3539 - تکرقمی"""
----input
14
----output
5
"""
digits = list(input())
while len(digits) > 1:
sum_digits = 0
for d in digits:
sum_digits += int(d)
digits = str(sum_digits)
# while len(digits) > 1:
# digits = str(sum([int(d) for d in digits]))
# digits = str(sum(list(map(int, digits)))
print(digits)282 - کامل بودن یا نبودن"""
----input
27
----output
No
----input
6
----output
YES
"""
n = int(input())
s = 0
for i in range(1, int(n/2) + 1):
if n % i == 0:
s += i
print("YES" if n == s else "NO")616 - توان دو"""
----input
95
----output
128
"""
n = int(input())
for i in range(n):
if 2**i > n:
print(2**i)
break591 - چاپ مربع"""
----input
6
----output
******
* *
* *
* *
* *
******
"""
n = int(input())
for i in range(1,n+1):
for j in range(1, n+1):
if i == 1 or i == n or j == 1 or j == n:
print("*", end="")
else:
print(" ", end="")
print()618 - چاپ لوزی"""
----input
3
----output
*
***
*****
*******
*****
***
*
"""
n = int(input())
for i in range(n):
print(" " * (n - i) + "*" * (2 * i + 1))
for i in range(n + 1):
print(" " * i + "*" * (2 * (n - i) + 1))3405 - چاپ برعکس"""
----input
3
4
7
4
9
0
----output
9
4
7
4
3
"""
nums = []
while True:
num = input()
if num == "0":
break
nums.append(num)
nums.reverse()
for num in nums:
print(num)617 - عدد خودمغلوب"""
----input
2356532
----output
YES
"""
digits = input()
digits_reverse = ""
for d in digits:
digits_reverse = d + digits_reverse
print("YES" if digits == digits_reverse else "NO")4065 - خر در چمن فراوونه!!"""
----input
1 1 1
----output
1
----input
3 4 5
----output
17
----input
10 3 2
----output
13
"""
a, b, l = [int(x) for x in input().split(" ")]
n = 0
time = 0
i = j = 0
while n < l:
if i == j:
i += 1
else:
j += 1
time = i * a + j * b
n += 1
print(time)10231 - خُب باقر سرما خورده"""
----input
N-MOLANA1
9A-UKOK
SAYE-NTERP
G-SANAEI
RF-MOLLASADRA
----output
1
----input
N321-HAFEEZ
F3-B12I
F-BI-12
OVO-JE-FE
KASHANI
----output
NOT FOUND!
----input
47-MOLANA
BOND-007
RF-MOLANA18
MARICA-13
13A-HAFEZLL
----output
1 3 5
"""
result = []
for i in range(1, 5 + 1):
x = input()
if "MOLANA" in x or "HAFEZ" in x:
result.append(str(i))
if result == []:
result = "NOT FOUND!"
print(' '.join(result))10232 - باقر خستهست ولی بیفرهنگ نه"""
----input
2 10
3 5 5
5 2 2
----output
12
----input
4 30
7 13 5
14 4 4
15 3 10
25 1 1
----output
36
"""
n, l = [int(i) for i in input().split(" ")]
time = 0
last_redlight = 0
for i in range(n):
d, r, g = [int(i) for i in input().split(" ")]
time += d - last_redlight
if time % (r + g) < r:
time += r - time % (r + g)
last_redlight = d
time += l - last_redlight
print(time)102250 - پیدایِش!"""
def find(num1, num2, num3):
pass
----input
>>> find(1, 2, 3)
----output
4
----input
>>> find(1, 4, 3)
----output
2
"""
def find(num1, num2, num3):
for i in range(1, 5):
if i not in [num1, num2, num3]:
return i148640 - آزمون تستی"""
----input
1
C
4
OO#O
OOOO
#OOO
OO##
----output
3
0
-1
-1
----input
10
AABBDCABCD
1
#OOO
#OOO
O#OO
O#OO
OOO#
OO#O
#OOO
O#OO
OO#O
OOO#
----output
30
"""
def check_score(answer, response):
abcd = {"A": 0, "B": 1, "C": 2, "D": 3}
score = 0
if "#" not in response:
return 0
for i in range(4):
if response[i] == "#":
if i != abcd[answer]:
return -1
else:
score = 3
return score
questions = int(input())
answers = input()
papers = int(input())
for p in range(papers):
score = 0
for q in range(questions):
response = input()
score += check_score(answers[q], response)
print(score)