DWITE '08 R2 #2 - My favourite digit

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
DWITE Online Computer Programming Contest, 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 will contain 5 lines, integers 0 \le N \le 1\,000\,000.

The output will contain 5 lines, each a single integer 0 \le n \le 9 – the largest digit present in the corresponding input number.

Sample Input

1
10
102
1025
9999

Sample Output

1
1
2
5
9

Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) Problem Resource: DWITE


Comments

There are no comments at the moment.