Simon likes drilling tunnels parallel to the ground. Simon has drilled horizontal line tunnels. Each tunnel starts from and ends at . What is the length of the longest tunnel that Simon has dug?
Input Specification
The first line of input will contain the single integer .
For each of the next lines, line will contain two space-separated integer values and .
Output Specification
On one line, the length of the longest tunnel.
Sample Input
3
1 8
9 150
0 81
Sample Output
141
Comments
Sean Combs
what if two tunnels are the same length?
down voting so toxic. valid question bro
You only need to find the longest tunnel, so you can choose either tunnel (if they're tied for the maximum length).
indeed, since your printing out the length not which tunnel it is