Farz0l1x

Untitled

Apr 16th, 2023
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. s = 'ИА ЕИА КЕ АБЖ ДЖАЕК ЖЗ БЗВ ЗАВ ВГ ГЗЖД'
  2. d = {c[0]:c[1:] for c in s.split()}
  3. def f(s, end):
  4.     if len(s) > 1 and s[-1] == end:
  5.         return 1
  6.     return sum(f(s + c, end) for c in d[s[-1]] if c not in s)
  7. print(f('А', 'З') + f('А', 'В'))
Advertisement
Add Comment
Please, Sign In to add comment