#C6662. Minimum Total Walking Distance
Minimum Total Walking Distance
Minimum Total Walking Distance
Three friends, Alice, Bob, and Charlie, live on a straight line. They want to meet at a common point to minimize the total walking distance. Given the positions of the three friends on the line, determine the minimum total distance they have to walk in order to meet at a single point.
The optimal meeting point is the median of their positions. In other words, if the positions are sorted as \(a \le b \le c\), the optimal meeting point is \(b\), and the total distance walked is \(|a-b|+|b-b|+|c-b| = |a-b|+|c-b|\>.
Read three integers from standard input that represent the positions, and output the minimum total walking distance.
inputFormat
The input consists of a single line with three space-separated integers:
- The position of Alice.
- The position of Bob.
- The position of Charlie.
outputFormat
Output a single integer representing the minimum total walking distance for the three friends to meet.
## sample1 4 6
5
</p>