Ordinary Numbers
A positive integer n is called ordinary if all its digits in decimal notation are the same. For example, 1, 2, and 99 are ordinary numbers, while 719 and 2021 are not.
Given a number n, count how many ordinary numbers exist between 1 and n.
Example 1
Input:
100
Output:
18
Example 2
Input:
5
Output:
5
main.cpp
C++
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat