# Need Trivial Help

Problem statement : STONES Problem - CodeChef
My code is:

``````#include <string.h>
#define MAX 101
int j[26*2];
int s[26*2];
int main(void) {
int t, i;
scanf("%d", &t);
while(t--){
char stone[MAX], jewel[MAX];
scanf("%s", jewel); scanf("%s", stone);
for(i = 0; i < 26*2; i++){
j[i] = 0; s[i] = 0;
}
for(i = 0; i < strlen(jewel); i++){
if(jewel[i] <= 'Z')
j[jewel[i] - 'A'] = 1;
else
j[jewel[i] - 'a' + 26] = 1;
}
for(i = 0; i < strlen(stone); i++){
if(stone[i] <= 'Z')
s[stone[i] - 'A'] = 1;
else
s[stone[i] - 'a' + 26] = 1;
}
int count = 0;
for(i = 0; i < 26*2; i++){
if(s[i] && j[i])
++count;
}
printf("%d\n", count);
}
return 0;
}
``````

I cant figure out whatâ€™s wrong in this simple code. Thanks.

According to the question if a character occurs in stone multiple times and it occurs in jewel even once , the answer would be the frequency of that character in stone. So you have to store the frequency of the characters rather than just checking the occurrence. For example

Jewel - a
Stone - aa