Search for a pair with the maximum sum in a list
Python
Medium
lists
Task «Search for a pair with the maximum sum in a list»
Given a list of integers, find two different elements of the list (with different indices) whose sum is maximum. If there are multiple such pairs, output the one where the first element (by index) is smaller. If the list contains fewer than two elements, output 'N/A'.
Input Format
The input is a single string containing integers separated by spaces.
Output Format
Output two numbers separated by a space — the desired pair (first the element with the smaller index). If no pair is found, output 'N/A'.
Examples
Example 1
INPUT
1 2 3 4
OUTPUT
3 4
Example 2
INPUT
5 5 5 5
OUTPUT
5 5
main.py