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