#P9581. Treasure Hunt on the Number Line
Treasure Hunt on the Number Line
Treasure Hunt on the Number Line
Little C loves to collect treasure chests in a game called "Deep Abyss". Currently, Little C is located at the origin on an infinite number line. There are two treasure chests on the number line at coordinates $$a$$ and $$b$$. When Little C reaches a position containing a treasure chest, he collects it. In particular, if he starts exactly at a chest's location, he collects it immediately; and if both chests are at the same location, he collects both at once.
Little C can move exactly one unit to the left (negative direction) or one unit to the right (positive direction) per move. Your task is to determine the minimum number of moves required for Little C to collect both treasure chests.
inputFormat
The input contains a single line with two space-separated integers $$a$$ and $$b$$, representing the coordinates of the two treasure chests on the number line.
outputFormat
Output a single integer representing the minimum number of moves required for Little C to collect both treasure chests.
sample
2 5
5