#CCBCHMOT0000054. Chữ số lớn nhất, nhỏ nhất (Minimum and Maximum Decimal Digits)

Chữ số lớn nhất, nhỏ nhất (Minimum and Maximum Decimal Digits)

Minimum and Maximum Decimal Digits

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

Given nonnegative integer n, output its smallest decimal digit followed by its largest decimal digit.

Input

One integer n.

Output

Print minimum and maximum digits separated by a space.

Subtasks

  • Subtask 1 (20%): 0≤n≤1000.
  • Subtask 2 (30%): 0≤n≤1000000000.
  • Subtask 3 (50%): 0≤n≤10^18.

Examples

Example 1

Input

40752

Output

0 7

Explanation

Digits 4,0,7,5,2 have minimum zero and maximum seven.

Example 2

Input

0

Output

0 0

Explanation

Zero has one digit, which is zero.