Check if Number Has Equal Digit Count Problem

Check if Number Has Equal Digit Count Problem — ExecCode School DSA Practice

Solve the Check if Number Has Equal Digit Count problem on ExecCode. Free online school DSA practice in Math. Write and run code in Java, C++, Python — no signup required to run.

Problem description

You are given a number made of digits. Your task is to for each digit in the number, look at its position (starting with zero for the first digit). See if the digit at that position is the same as how many times its position number appears in the whole number. If all positions match, print "true". Otherwise, print "false".

Examples

Input 1210; Output True. Input 030; Output False

Constraints

1 <= n <= 10^5

Practice Check if Number Has Equal Digit Count free on ExecCode. Browse DSA problems, topic map, and placement guides.