Problema
Mostra traduzioneCount how many decimal digits n has when written normally, without leading zeros.
Implement count_digits(n).
Input
n: A positive integer.
Output
Return the number of digits.
Vincoli
1 ≤ n ≤ 10¹⁸
Esempi
Esempio 1
Input:
n = 352
Output atteso:
expected = 3
Input:
long long n = 352;
Output atteso:
long long expected = 3;
Input:
long n = 352;
Output atteso:
long expected = 3;
Spiegazione
352 has three digits.
Esempio 2
Input:
n = 7
Output atteso:
expected = 1
Input:
long long n = 7;
Output atteso:
long long expected = 1;
Input:
long n = 7;
Output atteso:
long expected = 1;
Spiegazione
A single digit.