Brute-Force and One-Liner
I am sure some clever solution exists, but I did not want to spend too much time.\n\nYou can realize that the number of strings that match the criteria is very 
I am sure some clever solution exists, but I did not want to spend too much time.\n\nYou can realize that the number of strings that match the criteria is very small - 7, to be exact (see the second solution below).\n\n#### Brute-Force\n**C++**\n```cpp\nbool digitCount(string num) {\n    int cnt[10] = {};\n    for (auto n : num)\n        ++cnt[n - \'0\'];\n    for (int i = 0; i < num.size(); ++i)\n        if (cnt[i] != num[i] - \'0\')\n            return false;\n    return true;\n}\n```\n\n#### One-Liner\n```cpp\nbool digitCount(string &num) {\n    return unordered_set<string>{"1210", "2020" , "21200", "3211000", "42101000", "521001000", "6210001000"}.count(num);\n}\n```
['C']