{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\"\u003e\n\t\u003cp\u003eAnjali and Nakul are good friends. They both had a quarrel recently while playing chess. Nakul wants to know the minimum number of moves a knight takes to reach from one square to another square of a chess board (8 × 8). Nakul is brilliant and he had already written a program to solve the problem. Nakul wants to know whether Anjali can do it. Anjali is very weak in programming. Help her to solve the problem.\u003c/p\u003e\r\n\r\n\u003cp\u003eA knight can move in the shape of an \"L\" in a chessboard - two squares either forward, backward, left, or right and then one square to its left or right. A knight move is valid if it moves as mentioned above and it is within the boundary of the chessboard (8 × 8).\u003c/p\u003e\r\n\r\n\u003c!--\r\n\u003cp\u003e\u003ccenter\u003e\u003cimg src\u003d\"//0.tqn.com/d/chess/1/0/6/-/-/-/KnightMoves.gif\" alt\u003d\"//0.tqn.com/d/chess/1/0/6/-/-/-/KnightMoves.gif\" width\u003d\"400\" /\u003e\u003c/center\u003e\u003c/p\u003e\r\nOld image link - broken\r\n--\u003e\r\n\u003cp\u003e\u003cimg title\u003d\"knight\" src\u003d\"CDN_BASE_URL/0e5675b46ee352b41bb68918d46ed332?v\u003d1726731951\" alt\u003d\"knight\" width\u003d\"50%\"\u003e\u003c/p\u003e\r\n\u003ch3\u003eInput\u003c/h3\u003e\r\n\u003cp\u003eThere are T test cases in total. The next T lines contain two strings (start and destination) separated by a space.\u003c/p\u003e\r\n\u003cp\u003eThe strings start and destination will only contain two characters - First character is an alphabet between \u0027a\u0027 and \u0027h\u0027 (inclusive), Second character is a digit between \u00271\u0027 and \u00278\u0027 (inclusive) - (Quotes just for clarity).\u003c/p\u003e\r\n\u003cp\u003eTo know the knight moves more clearly refer to the above figure.\u003c/p\u003e\r\n\r\n\u003ch3\u003eOutput\u003c/h3\u003e\r\n\u003cp\u003ePrint the minimum number of moves a knight takes to reach from start to destination in a separate line.\u003c/p\u003e\r\n\r\n\u003ch3\u003eConstraints\u003c/h3\u003e\r\n\u003cp\u003e1 \u0026lt;\u003d T \u0026lt;\u003d 4096\u003c/p\u003e\r\n\r\n\u003ch3\u003eExample\u003c/h3\u003e\r\n\u003cdiv\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\r\na1 h8\r\na1 c2\r\nh8 c3\r\n\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e6\r\n1\r\n4\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e"}}]}