题解 | #计算某字符出现次数#
计算某字符出现次数
https://www.nowcoder.com/practice/a35ce98431874e3a820dbe4b2d0508b1
#include <bits/stdc++.h> #include <cctype> using namespace std; int main() { int a[100]={0}; char ch; while(ch=cin.get(),ch!='\n'){ ch=tolower(ch); a[ch-'0']++; } ch=tolower(getchar()); cout<<a[ch-'0']; return 0; } // 64 位输出请用 printf("%lld")
数组哈希