jewels and stones

my code is giving me the desired output on my compiler but code chef is giving wrong answer for that…
please check what’s wrong with my code…here it is…CodeChef: Practical coding for everyone

Please include the link to the question along with an explanation of your logic while posting questions here .