题解 | #计算某字符出现次数#
计算某字符出现次数
https://www.nowcoder.com/practice/a35ce98431874e3a820dbe4b2d0508b1
#include <stdio.h>
#include<ctype.h>
int main() {
int a = 0, b = 0,len=0; char i, j, s[1000]; gets_s(s); scanf("%c",&i); char *p = s; i = tolower(i); while (*p != 0) { s[a] = tolower(s[a]); if (s[a] == i) { b++; } a++; p++; } printf("%d", b); return 0;
}