题解 | 数颜色
数颜色
https://www.nowcoder.com/practice/7f458453debe49c9a98f20f42d65ebf1
//我的算法练习 5
#include <bits/stdc++.h>
using namespace std;
void solve()
{
string s;
int R{0};
int G{0};
int B{0};
cin >> s;
for( char ch : s)
{
if(ch == 'R') R++;
else if(ch == 'G') G++;
else if(ch == 'B') B++;
}
cout << "(" <<R <<","<< G <<","<< B <<")\n";
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
solve();
return 0;
}
