Dễ 0 đã giải Tỷ lệ chấp nhận 0%

Largest Digit

Find the largest decimal digit of a positive integer.

Look at every decimal digit of n and return the largest one.

Implement largest_digit(n).

Input

n: A positive integer.

Output

Return the largest digit, from 0 to 9.

Ràng buộc

1 ≤ n ≤ 10¹⁸

Ví dụ

Ví dụ 1
Đầu vào:
n = 352

Kết quả mong đợi:
expected = 5
Đầu vào:
long long n = 352;

Kết quả mong đợi:
long long expected = 5;
Đầu vào:
long n = 352;

Kết quả mong đợi:
long expected = 5;

Giải thích

The digits are 3, 5 and 2; the largest is 5.

Ví dụ 2
Đầu vào:
n = 7

Kết quả mong đợi:
expected = 7
Đầu vào:
long long n = 7;

Kết quả mong đợi:
long long expected = 7;
Đầu vào:
long n = 7;

Kết quả mong đợi:
long expected = 7;

Giải thích

The only digit is 7.

Học hỏi từ người khác

Giải pháp cộng đồng

Chưa có giải pháp nào được chia sẻ. Hãy giải thử thách này để đăng giải pháp đầu tiên.