c++ | easy | short
\n\n# Code\n\nclass Solution {\npublic:\n    int countMatches(vector<vector<string>>& items, string ruleKey, string ruleValue) {\n        int i;\n        if(rul
\n\n# Code\n```\nclass Solution {\npublic:\n    int countMatches(vector<vector<string>>& items, string ruleKey, string ruleValue) {\n        int i;\n        if(ruleKey=="type")i=0;\n        if(ruleKey=="color")i=1;\n        if(ruleKey=="name")i=2;\n        \n        int ans=0;\n        for(int j=0;j<items.size();j++){\n            if(items[j][i]==ruleValue)ans++;\n        }\n        \n        return ans;\n    }\n};\n```
['C++']