题解 | #计算某字符出现次数#
计算某字符出现次数
https://www.nowcoder.com/practice/a35ce98431874e3a820dbe4b2d0508b1
#include <iostream>
#include <unordered_map>
#include <string>
using namespace std;
int main() {
string s;
getline(cin,s);
char c;
cin >> c;
unordered_map<char,int> mp;
for (char ch:s){
if (tolower(ch)==tolower(c))
mp[c]++;
}
cout << mp[c] << endl;
}
#14天打卡计划##23届找工作求助阵地##我的求职思考##C++零基础学习#
查看13道真题和解析