题解 | #字符的个数#
字符的个数
http://www.nowcoder.com/practice/dc28f2bf113a4058be888a5875206238
#include<bits/stdc++.h> using namespace std; #include <string.h>
int main(){ string s; cin>>s;
int m = 0,n = 0,p = 0;
for(int i = 0; i < s.size();i++)
{
if(s[i] == 'a')
{
m++;
}
else if(s[i] == 'b')
{
n++;
}
else
{
p++;
}
}
cout << m << " " << n << " " << p << endl;
// write your code here......
return 0;
}