Innohorse
InterviewTime limit1sMemory limit512 MB
Given the start and end cells of a knight-like jump on an 8x8 board, recover the ordered pair (x, y) with x <= y that describes the move.
- Level
Easy3 of 10
- Topics
- Implementation, Math, Brute force, Geometry
- Solved
- No attempts yet
Problem
In Innokingdom there are special horses for chess knights, innohorses. Each innohorse is represented by a pair of integers , . An innohorse moves in the following way: first it moves cells in one of the four general directions, then turns 90 degrees to the left or to the right, then finally moves more cells. For instance, an ordinary chess knight is an innohorse of type .
Alex and Jane have just seen one innohorse, it jumped from cell A to cell B. They wonder what the type of this innohorse is. Help them answer this question.
Input
The chessboard consists of 8 rows and 8 columns. Rows are assigned integers from 1 to 8, and columns are assigned letters from 'a' to 'h'. So every cell is represented by a pair of a letter and a digit.
Two lines consist of descriptions of cells A and B respectively.
Output
Print two integers and (), representing the type of innohorse.