Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
- def f(x, y, c):
- if x[-1] == y:return c == 5
- elif 'M' in x or c > 5:return 0
- else:return f(x + alp[alp.index(x[-1]) + 1], y, c + 1) + f(x + alp[alp.index(x[-1]) + 4], y, c + 1)
- print(f('A', 'O', 0))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement