标签:
3 BBRRWBWRRR RRRWWRWRB RBRW
RRRRRWWBBB RRRRRWWWB RRWB
代码:
01.
#include<iostream>
02.
#include<string>
03.
using
namespace
std;
04.
int
main()
05.
{
06.
int
t;
07.
cin>>t;
08.
while
(t--)
09.
{
10.
string str;
11.
int
i,j,k,m,n,len,a[1001];
12.
cin>>str;
13.
len = str.length();
14.
for
(i = 0;i <len;i++)
15.
a[i] = str[i] -
‘0‘
;
16.
m= 0;j= 0;k= 0;
17.
for
(i = 0;i < len;i++)
18.
{
19.
n = a[i];
20.
switch
(n)
21.
{
22.
case
18:m++;
break
;
23.
case
34:j++;
break
;
24.
case
39:k++;
break
;
25.
}
26.
}
27.
//cout<<m<<j<<k;
28.
for
(i = 0;i < j;i++)
29.
cout<<
"R"
;
30.
for
(i = 0;i < k;i++)
31.
cout<<
"W"
;
32.
for
(i = 0;i < m;i++)
33.
cout<<
"B"
;
34.
cout<<endl;
35.
}
36.
return
0;
37.
}
标签:
原文地址:http://blog.csdn.net/u012701023/article/details/46043107