题解 | #计算某字母出现次数#
计算某字母出现次数
http://www.nowcoder.com/practice/a35ce98431874e3a820dbe4b2d0508b1
#include <stdio.h> #include <string.h> int main(void) { char a[10000] = {0}; fgets(a, sizeof(a),stdin); char c; scanf("%c", &c); getchar(); int count = 0; int len = strlen(a); for(int i = 0;i < len;i++) { if(a[i] == c || a[i] == c + 32 || a[i] == c - 32) count++; } printf("%d\n",count); return 0; }