Advertisement
Guest User

chees

a guest
Oct 6th, 2016
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. line = input()
  2. letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
  3.  
  4. if ((line[0] or line[3]) not in letters) or ((int(line[1]) or int(line[4])) not in range(1, 9)):
  5.     print("ERROR")
  6. elif abs(ord(line[0]) - ord(line[3])) == 1 and abs(int(line[1]) - int(line[4])) == 2:
  7.     print("YES")
  8. elif abs(ord(line[0]) - ord(line[3])) == 2 and abs(int(line[1]) - int(line[4])) == 1:
  9.     print("YES")
  10. else:
  11.     print("NO")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement