Distinct Words and Lexicographic Extremes


Submit solution

Points: 100
Time limit: 2.0s
Memory limit: 256M

Author:
Problem types

Analyze the whitespace-separated words in a nonempty line.

Input

The input contains one line of letters and spaces. Consecutive spaces are separators and are ignored.

$1 \le |s| \le 10^6$; the line contains letters and spaces and at least one word. Comparisons are case-sensitive.

Output

Print the number of distinct words. On the next line print the lexicographically smallest and largest words.

Example

Input
ngo ngoc an nguyen an ngoc ngoc
Output
4
an nguyen

Comments

There are no comments at the moment.