Each number is the height of a vertical line at that position. Choose two lines that, together with the x-axis, hold the most water. Area = distance between them × the shorter height.
Input: one line of space-separated heights.
Output: the maximum area.
Your program reads from stdin and prints to stdout.
Each number is the height of a vertical line at that position. Choose two lines that, together with the x-axis, hold the most water. Area = distance between them × the shorter height.
Input: one line of space-separated heights.
Output: the maximum area.
Your program reads from stdin and prints to stdout.