#C4326. Autobiographical Numbers
Autobiographical Numbers
Autobiographical Numbers
An autobiographical number is a number where the i-th digit (starting from 0) describes the number of times digit i appears in the number. Formally, if a number is represented as \(d_0d_1\dots d_{n-1}\), then for every \(i\) in \(\{0,1,\dots,n-1\}\), the following must hold:
[ d_i = \text{number of occurrences of } i \text{ in the number}, ]
For example, 1210
is an autobiographical number because it has 1 zero, 2 ones, 1 two, and 0 threes. Your task is to determine if a given number is an autobiographical number.
inputFormat
The input consists of a single integer \(N\) given via standard input (stdin).
outputFormat
Output a single line to standard output (stdout) containing True
if the number is an autobiographical number, or False
otherwise.
1210
True