C语言中字符查找问题

17 字符查找问题
Time Limit:1000MS Memory Limit:65535K
题型: 编程题 语言: G++;GCC
描述
输入一串字符串,统计输出字母a出现的次数。统计字母时区分大小写,字符串可以包含字母、数字、空格和其他符号如@#&%等。
备注:要求字符串长度不超过20,输入字符串时以回车结束。

输入样例
Sdhjweaaa2367
输出样例
3

#include <stdio.h>
int main()
{
    char s[1000],c;
    int count = 0,i=0;
    gets(s);
    c = getchar();
    while(s[i] != 0)
    {
        if(s[i] == ch)
            count++;
        i++;
    }
    printf("%d",count);
}