Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- s = input()
- i = s.find(' ')
- n = int(s[0: i])
- m = int(s[i + 1: len(s)])
- strings = []
- for i in range(n):
- s = input()
- strings.append(s[0: m + 1])
- pn = int(input())
- passwords = ['']
- def generate_password(i = 0, j = 0, n = 0, m = 0, password = ''):
- if ((i < n) or (j < m)):
- password = password + strings[i][j]
- if (i < n):
- generate_password(i + 1, j, n, m, password)
- if (j < m):
- generate_password(i, j + 1, n, m, password)
- else:
- passwords.append(password)
- print(password)
- generate_password(0, 0, n, m, '')
- passwords
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement