Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from itertools import product
- count = 0
- for x in product('ДЕЙКСТРА', repeat = 6):
- s = ''.join(x)
- if s.count('Й') == 1 and s[-1] != 'Й':
- i = s.find('Й')
- if s[i + 1] == 'Д' or s[i + 1] == 'К' or s[i + 1] == 'С' or s[i + 1] == 'Т' or s[i + 1] == 'Р':
- count += 1
- print(count)
Advertisement
Add Comment
Please, Sign In to add comment