205. Count the Digits
Foundation1000 ms256 MBSolved by 0%
Print how many digits n has.
Dividing by 10 removes the last digit, so each recursive call works on a number one digit shorter. That is your step towards the base case.
Read the constraints before choosing where to stop. n can be 0, and 0 has
one digit, not none.
Constraints - `0 ≤ n ≤ 1000000000`
Input
A single line containing one integer n.
Output
Print one integer, the number of digits in n.
Input999
Output3
Noteis a plain three-digit number
Input0
Output1
Notehas one digit, which a naive base case reports as zero
Hint 1Approach
Hint 2Approach
Hint 3Pseudocode
Hint 4Full solution