题解 | #字符的个数#

字符的个数

https://www.nowcoder.com/practice/dc28f2bf113a4058be888a5875206238

#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    // write your code here......
    int a=0,b=0,c=0;
    int count=0;
    while(s[count]!='\0'){
        if(s[count] == 'a'){
            a++;
        }
        if(s[count] == 'b'){
            b++;
        }
        if(s[count] == 'c'){
            c++;
        }
        count++;
    }
        cout<<a<<" "<<b<<" "<<c<<endl;
    
    return 0;
}

全部评论

相关推荐

苍蓝星上艾露:这简历。。。可以试试我写的开源简历优化工具https://github.com/weicanie/prisma-ai
点赞 评论 收藏
分享
牛客73617529...:无端端被你骂一句
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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