Knights

Report a typo

You have the coordinates of two knights on a chessboard. Find out whether they can beat each other.

the coordinates of two knights on a chessboard

Input data format

Four integer numbers x1,y1,x2,y2 x_1, y_1, x_2, y_2 .

Output data format

Type "YES" (uppercase) if they beat each other and "NO" if they don't.

You may need a method that calculates the absolute value of a number:

import kotlin.math.*

println(abs(-5)) // 5

Sample Input 1:

1 1
2 3

Sample Output 1:

YES

Sample Input 2:

1 1
2 2

Sample Output 2:

NO

Sample Input 3:

1 1
1 4

Sample Output 3:

NO

Sample Input 4:

4 3
3 5

Sample Output 4:

YES
Write a program in Kotlin
fun main() {
// write your code here
}
___

Create a free account to access the full topic