AC
计算字符个数
http://www.nowcoder.com/questionTerminal/a35ce98431874e3a820dbe4b2d0508b1
#include<iostream> #include<algorithm> using namespace std; int main() { string s; getline(cin, s); char a = 0; cin >> a; int num = 0; for(int i = 0; i < s.length(); i++) { if(s[i] == a) { num++; } else if(int(s[i]) + 32 == int(a)) { num++; } } cout << num; return 0; }