标签:style blog io color ar os sp for 数据
3
BBRRWBWRRR
RRRWWRWRB
RBRW
RRRRRWWBBB
RRRRRWWWB
RRWB
1 #include <stdio.h> 2 3 int main(){ 4 int T; 5 char s[1001]; 6 int R_number; 7 int W_number; 8 int B_number; 9 int i; 10 11 scanf("%d",&T); 12 13 while(T--){ 14 scanf("%s",&s); 15 16 R_number=0; 17 W_number=0; 18 B_number=0; 19 20 for(i=0;s[i]!=‘\0‘;i++){ 21 if(s[i]==‘R‘) 22 R_number++; 23 24 else if(s[i]==‘W‘) 25 W_number++; 26 27 else 28 B_number++; 29 } 30 31 for(i=1;i<=R_number;i++) 32 printf("R"); 33 34 for(i=1;i<=W_number;i++) 35 printf("W"); 36 37 for(i=1;i<=B_number;i++) 38 printf("B"); 39 40 printf("\n"); 41 } 42 return 0; 43 }
标签:style blog io color ar os sp for 数据
原文地址:http://www.cnblogs.com/zqxLonely/p/4099267.html