#K55202. Minimum Moves: Manhattan Distance Calculation
Minimum Moves: Manhattan Distance Calculation
Minimum Moves: Manhattan Distance Calculation
Given two points with integer coordinates, compute the minimum number of moves required to travel from the starting point to the ending point. The moves are measured using the Manhattan distance.
For two points ( (x_1, y_1) ) and ( (x_2, y_2) ), the Manhattan distance is defined as:
( |x_2 - x_1| + |y_2 - y_1| ).
inputFormat
Input consists of two lines.
The first line contains two space-separated integers ( x_1 ) and ( y_1 ) representing the starting point.
The second line contains two space-separated integers ( x_2 ) and ( y_2 ) representing the ending point.
outputFormat
Output a single integer which is the Manhattan distance between the two points, i.e. ( |x_2 - x_1| + |y_2 - y_1| ).## sample
0 0
0 0
0