Second Largest Values

Write a program that prints the second largest value in each row of a
given matrix.

Your solution must meet the following conditions:

- Write a function

      def second_largest_values(m)

  that receives a matrix of strictly positive integer numbers and
  returns a list with the second largest value in each row.

- write a main program that reads a matrix of integers from the input,
  and prints the second largest values in each row. The program must
  call the function second_largest_values.

Input

The input is a matrix of strictly positive integers. Each row of the
matrix is given in a separate line. All lines have the same amount of
elements. Each row contains at least two different values.

Output

The output is the list of the second largest values in each row, in the
format shown in the examples.

Problem information

Author: ProAl1 professors

Generation: 2026-01-25T15:16:59.734Z

© Jutge.org, 2006–2026.
https://jutge.org
