题解 | 数颜色

数颜色

https://www.nowcoder.com/practice/7f458453debe49c9a98f20f42d65ebf1

#include <iostream>
using namespace std;
#include <string>
int main() {
    string s;
    cin>>s;
    int a=0,b=0,d=0;
    for(char c:s){
       if(c=='R')a++;
       else if(c=='G')b++;
       else d++;
    }
    cout<<"("<<a<<","<<b<<","<<d<<")"<<endl;
    return 0;
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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