Three Kangaroos 2
Time limit1sMemory limit256 MB
Three kangaroos on integer points let an outer one jump between the other two, and each test case asks for the largest possible number of jumps.
Problem
Three kangaroos play in a desert. The desert holds one number line, and the three kangaroos sit on three different integer coordinates.
In one move, one of the two outer kangaroos jumps to an integer coordinate between the other two kangaroos. Two or more kangaroos can never sit on the same coordinate.
Find the largest number of moves the kangaroos can make.
Input
The input holds several test cases. Each line gives the starting positions , , of the three kangaroos. ()
The number of test cases is not given. Read until the end of the input.
Output
For each test case, print the largest number of moves the kangaroos can make, one per line.