# Read the number of the encryption

• Only four lines are always placed at the entrance, a graphic image of the encrypted number, each numerical of which is marked by symbols ('#' and '.') of one of the following matrices:

For example, if four lines are presented at the entrance:

If you don't want to go out, you're gonna have to get one line with 79098654321.

Now, in this task, we need to turn the number that's identified from the graphic image. The number may be within the range [0; 1000000].

``````sp = [['##','##','##','##'],
['.#','##','.#','.#'],
['##','.#','#.','##'],
['##','.#','.#','##'],
['##','##','.#','.#'],
['##','#.','.#','##'],
['.#','#.','##','##'],
['##','.#','#.','#.'],
['##','..','##','##'],
['##','##','.#','#.']]
tmp = []
text = []
for i in range(4):
text = input()
tmp.append([text[i:i+2] for i in range(0, len(text), 2)])
``````

I can't finish it. Let me see. I can't figure out how the incoming data are to be built in order?

• For example, such a code can be made:

``````text = ['.###', '##.#', '.##.', '.##.'] # пример числа 17
dictionary = ['########', '.###.#.#', '##.##.##', '##.#.###', '####.#.#', '###..###', '.##.####', '##.##.#.', '##..####', '####.##.']
res = ''
for i in range(0, len(text[0]), 2):
figure = text[0][i:i+2] + text[1][i:i+2] + text[2][i:i+2] + text[3][i:i+2]
if figure not in dictionary:
res += '*'
else:
res += str(dictionary.index(figure))

print(res)
``````

variables `text` I've got two numbers, but if I have to ask for the keyboard, I have to do this:

``````text = [input(), input(), input(), input()]
``````

Well, if there's a wish to do everything in line one:

``````res = ''.join(str(dictionary.index(''.join(text[j][i:i+2] for j in range(4)))) if ''.join(text[j][i:i+2] for j in range(4)) in dictionary else '' for i in range(0, len(text[0]), 2))
``````

And if there's no left symbols outside the vocabulary, which are replaced by me. `''`the code can be further simplified:

``````res = ''.join(str(dictionary.index(''.join(text[j][i:i+2] for j in range(4)))) for i in range(0, len(text[0]), 2))
``````

2

2

2

2

2

2

2

2

2

2

2

2

2

2

2