First Presence of an Opposite Pair

Write a program that receives on stdin lines containing integers and
writes out the first line in which both some number and its opposite
appear; the line is to be reported together with the number itself.

Input

The input is a sequence of zero or more lines. Each line cointains zero
or more integers, separated by spaces.

Output

Output is the first line of the input in which both some number n and
its opposite −n appear, preceded by the non-negative case of the number
itself, with ": " (colon-single space) as separator. If several such
numbers appear, the earliest-starting pair is to be reported. If there
is no such line, the program must write "Not found."

Problem information

Author: José Luis Balcázar

Generation: 2026-01-25T17:02:55.092Z

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