Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/while-eng-katta-va-eng-kichik-raqam

Largest and smallest digit

Easy 1000 ms 64 MB 33%
Share

A positive integer $n$ is given. Find the largest and the smallest of its digits.

Choosing the maximum and the minimum among all digits of the number

Input

One positive integer $n$.

Output

One line with two integers separated by a space: the largest and the smallest digit.

Note

$1 \le n \le 10^{18}$

Examples

Input #1
30528
Output #1
8 0
Input #2
777
Output #2
7 7

Sign in to submit a solution

Signing up is free and takes a minute.