题解 | 数颜色
数颜色
https://www.nowcoder.com/practice/7f458453debe49c9a98f20f42d65ebf1
#include <iostream>
using namespace std;
int main() {
int R=0;
int G=0;
int B=0;
string a;
cin>>a;
for(int i=0;i<size(a);i++)
{
if(a[i]=='R')R++;
if(a[i]=='G')G++;
if(a[i]=='B')B++;
}
cout<<"("<<R<<","<<G<<","<<B<<")";
return 0;
}
//a.length() 或者 a.size() 来获取字符串的实际长度。
// 64 位输出请用 printf("%lld")
