You are viewing a single comment's thread. Return to all comments →
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int n; scanf("%d",&n); char list[1000][20]; for(int i=0;i<n;i++) scanf("%s",list[i]); int q; scanf("%d",&q); char queries[1000][20]; for(int i=0;i<q;i++) scanf("%s",queries[i]); int countarr[q]; int count; for(int i=0;i<q;i++) { count=0; for(int j=0;j<n;j++) { if(strcmp(queries[i],list[j])==0) count++; } printf("%d\n",count); }
return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Sparse Arrays
You are viewing a single comment's thread. Return to all comments →
}