#K45567. Self-Descriptive Number Checker
Self-Descriptive Number Checker
Self-Descriptive Number Checker
A self-descriptive number is defined as an integer \( n \) in which for every digit position \( i \) (starting at 0), the digit \( d_i \) represents the number of times the digit \( i \) appears in \( n \). In other words, if \( n \) is represented as a string of digits \( d_0d_1...d_{k-1} \), then for every \( i \) from 0 to \( k-1 \), the following condition must be satisfied:
[ d_i = \text{count of digit } i \text{ in } n ]
Your task is to determine whether a given integer is self-descriptive.
inputFormat
The input consists of a single line containing an integer \( n \) (\( 0 \le n \le 10^{18} \) for instance).
outputFormat
Output a single line with either True
if \( n \) is self-descriptive, or False
otherwise.
2020
True