题解 | 数颜色
数颜色
https://www.nowcoder.com/practice/7f458453debe49c9a98f20f42d65ebf1
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void) {
char ch[100005];
scanf("%s", ch);
int len = strlen(ch);
int count_r = 0, count_g = 0, count_b = 0;
for(int i = 0; i < len; i++){
if(ch[i] == 'R') count_r++;
else if(ch[i] == 'G') count_g++;
else count_b++;
}
printf("(%d,%d,%d)", count_r, count_g, count_b);
return 0;
}


