c++ solution
\nclass Solution {\npublic:\n    int countMatches(vector<vector<string>>& items, string ruleKey, string ruleValue) \n    {\n        int x;\n        if(ruleKey =
```\nclass Solution {\npublic:\n    int countMatches(vector<vector<string>>& items, string ruleKey, string ruleValue) \n    {\n        int x;\n        if(ruleKey == "type")\n            x=0;\n        else if(ruleKey == "color")\n            x=1;\n        else if(ruleKey == "name")\n            x=2;\n        else\n            x=-1;\n        int count = 0,i,j;\n        if(x != -1)\n        {\n            for(i=0; i<items.size(); i++)\n            {\n                if(items[i][x] == ruleValue)\n                    count++;\n            }    \n        }\n        \n        return count;\n    }\n};\n```
[]