PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#sample input, you can use copy and paste it to Sololearn's' input popout
"""
5 2
abcab
bceba
fghob
abcab
bceba
ab
"""
"""
expected output -> 9
"""
#processing the inputs
r, _ = input().split() # second number not used
r = int(r)
src = []
for _ in range(r):
src.append(input())
target = input()
#using Ipang's function, simplified for square matrix
def vertical_mixer(src, n):
res = [ [] for i in range(n) ]
for el in src:
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run