class Solution { public: int countMatches(vector<vector<string>>& items, string ruleKey, string ruleValue) { int n=items.size(); int p=3; int i; int c=0; if(ruleKey=="type") { i=0; for(int j=0;j<n;j++) { if(items[j][i]==ruleValue) {c++;} } } else if(ruleKey=="color") { i=1; for(int j=0;j<n;j++) { if(items[j][i]==ruleValue) {c++;} } } else if(ruleKey=="name") { i=2; for(int j=0;j<n;j++) { if(items[j][i]==ruleValue) {c++;} } } return c; } };