Chess
Time limit2sMemory limit1024 MB
Tigra moves two squares straight or one square diagonally on an 8x8 board; decide whether it can reach the Slonopotam's square.
- Level
Easy2 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
Yesterday the wise Owl found a chess set in her castle, Kashtany. Only the Rabbit had listened to the rules and remembered them in full, so the Owl decided to simplify them. Only two pieces remain on the board. One is the Slonopotam, which gave its name to the ordinary chess bishop. The other is Tigra. The Slonopotam never moves, since a real Slonopotam hides in ambush. Tigra jumps two squares vertically or horizontally, or one square diagonally. Determine whether Tigra can capture the Slonopotam, that is, land on the same square as it during a game.
Input
Two lines contain the squares of Tigra and the Slonopotam, one per line. Each square is a letter from a to h followed by a digit from 1 to 8, with no spaces.
Output
Print YES if Tigra can capture the Slonopotam, and NO otherwise.
Hint
