Buy1Get1 Wrong Answer ,Help!!

#include<stdio.h>
int cost(char *);
int main()
{
char s[100][201];
int t,i=0;
scanf("%d",&t);
while(i<t)
{
scanf("%s",s[i]);
i++;

}
for(i=0;i<t;i++)
{
    printf("%d\n",cost(s[i]));
}
    return 0;

}
int cost(char s)
{
int i=0,ch,j=0,price;
int alphaC[26]={0},alphaS[26]={0};
while(
(s+i)!=’\0’)
{
ch=0;
if((s+i)>=65&&(s+i)<90)
{
ch=(s+i)-65;
alphaC[ch]++;
}
if(
(s+i)>=97&&(s+i)<=122)
{
ch=
(s+i)-97;
alphaS[ch]++;
}
i++;
}
price=0;
for(i=0;i<26;i++)
{
if(alphaS[i]==0||alphaC[i]==0)
continue;
else
{
j=alphaC[i];
price+=j/2+j%2;
j=alphaS[i];
price+=j/2+j%2;
}
}
return price;
}

There are some minor mistakes, but the approach is absolutely correct.

These are the corrections:

  1. The range is wrong for upper case alphabets.

    Correction:
if(*(s+i)>=65&& *(s+i)< = 90)

2. There is a need to perform addition to price for both alphaC[] and alphaS[] but your solution skips the other one if even one of them is equal to 0.
Suppose for alphaC[0]=3 and alphaS[0]=0
Your solution does not add alphaC[0] to price it simply skips it because of continue;

Here is your corrected solution: http://www.codechef.com/viewsolution/4371972