Hard
Is the Chess Move Legal?
Read a piece (
king, queen, rook, bishop or knight) and two squares like e2 e4 on an empty board. Print legal if that piece can move from the first square to the second in one move, otherwise illegal. Staying on the same square is illegal.Input
One line: piece from to.
Output
One word.
Sample 1
Input
knight g1 f3
Output
legal
Sample 2
Input
bishop c1 h6
Output
legal
Output appears here