题解 | 数颜色
数颜色
https://www.nowcoder.com/practice/7f458453debe49c9a98f20f42d65ebf1
#include <stdio.h>
int main()
{
char S[100001] = "0";
scanf("%s", S);
char* ps = S;
int countr = 0;
int countg = 0;
int countb = 0;
while (*ps)
{
switch (*ps)
{
case 'R':
countr++;
break;
case 'G':
countg++;
break;
case 'B':
countb++;
break;
}
ps++;
}
printf("(%d,%d,%d)", countr, countg, countb);
return 0;
}

