#K43512. Product of the Two Largest Numbers
Product of the Two Largest Numbers
Product of the Two Largest Numbers
Given multiple lines of input, each containing a series of space-separated integers, your task is to compute the product of the two largest integers in each line. Print the result of each computation on a separate line.
Specifically, for each line:
- Parse the integers.
- Identify the two largest numbers.
- Compute their product. That is, if the two largest numbers are \(a\) and \(b\), then output \(a \times b\).
Note that the input can contain negative integers. In such cases, the largest numbers are determined by their numerical value (for example, among negative numbers, \(-1\) is greater than \(-5\)).
The input is provided via standard input (stdin) and the output should be sent to standard output (stdout).
inputFormat
The input consists of one or more lines. Each line contains at least two integers separated by spaces.
Example:
3 5 1 2 10 15 20 30 4 3 8 7
outputFormat
For each line of input, output the product of the two largest integers on that line. Each result should appear on its own line.
Example corresponding to the above input:
15 600 56## sample
3 5 1 2
15