题解 | #字符的个数#

字符的个数

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;

}

全部评论

相关推荐

不愿透露姓名的神秘牛友
05-25 18:29
点赞 评论 收藏
分享
写不来代码的小黑:这么小的城市能有做it的公司也不容易
点赞 评论 收藏
分享
评论
2
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务