Learn
Exam

Count the Number of Digits

Difficulty
STARTER

Problem

Write a function solution that returns the number of digits in the given natural number number.


Constraints

  • number is a natural number between 1 and 10^18 inclusive.

Test Case

Test Case Number number return
1 12345 5
2 9876543210 10
3 1000000000000000000 19

Explanation for Test Case 1

  • When number = 12345, it has 5 digits, so the return value is 5.

Explanation for Test Case 2

  • When number = 9876543210, it has 10 digits, so the return value is 10.

Explanation for Test Case 3

  • When number = 1000000000000000000, it has 19 digits, so the return value is 19.