In a party, there are 4 dress codes i.e. one can either wear Red(R) or Blue(B) or Green(G) or Yellow(Y). Photographer needs the most colorful pic he can, so he arranges people in a specific order like RGBYRGBY, RYBGRY, RYBGR, RGBYRGB but no order like GGBRGBR, BGYBGY, GBGGBYR. Using the given information you have tell the no. of persons of a particular color required in the order if there is a place for a particular color to have the colorful pic.
The first line of input contains a single integer T denoting the number of test cases. Then T test cases follow. First line contains a string representing the 'order' where an '!' denotes a missing character. You may assume that no Input like GBYR!Y!!!! or YG!!RB!G will be given.
For each test case in a new line print the string RxByYmGn where x, y, m, n represent the count of the missing colors ie red, blue, yellow, green in the string which satisfies the order.
1<=Length of string<=1000
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.