DWITE Online Computer Programming Contest

My favourite digit

November 2008
Problem 2

Simply speaking, you need to know how to handle your numbers well. Given an integer, what is the largest digit present in that number?

The input file DATA2.txt will contain 5 lines, integers 0 ≤ N ≤ 1,000,000.

The output file OUT2.txt will contain 5 lines, each being a single integer 0 ≤ n ≤ 9 – the largest digit present in the corresponding input number.

Sample Input:
1
10
102
1025
9999
Sample Output:
1
1
2
5
9