https://app.hackthebox.com/challenges/815

Description

In a haunted graveyard, spirits hide among the numbers. Can you identify the smallest and largest among them before they vanish?

Task

MiniMax

We’ve intercepted codes from an underground organisation with intentions of malicious activity. Intelligence has informed us that most of the numbers are garbage, but the biggest and smallest numbers in the file form co-ordinates of the group’s next attack location.

Identify these 2 numbers, then print out first the minimum and then the maximum. Please be swift, agent - the clock is ticking!

Example

Input

3.29 3.09 1.34 2.89

Output

1.34

3.29

Exploitation

import sys

numbers = []
for line in sys.stdin:
   nums = [float(x) for x in line.split()]
   numbers.extend(nums)

min_num = min(numbers)
max_num = max(numbers)
print(min_num)
print(max_num)

Summary

MinMax: reduce the custom rules to a scriptable check and use the smallest reliable path to the flag.