Count Digits

Given a non-negative integer n, return the number of digits in its decimal representation. The value 0 has one decimal digit.

Given a non-negative integer `n`, return the number of digits in its decimal representation. The value `0` has one decimal digit.

- `0 <= n <= 10^9` - The input has no leading zeroes except for the value `0` itself.

Example 1: input n = 4921; output 4. The decimal representation 4921 contains four digits.

Example 2: input n = 0; output 1. Zero is represented by one decimal digit.

Example 3: input n = 100000; output 6. One followed by five zeroes has six digits.

Category: Math. Topic: math. Difficulty: Easy. Patterns: math.