#include #define _overload(_1,_2,_3,name,...) name #define _rep(i,n) _range(i,0,n) #define _range(i,a,b) for(int i=int(a);i=int(b);--i) #define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__) #define _all(arg) begin(arg),end(arg) #define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg)) #define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary) #define clr(a,b) memset((a),(b),sizeof(a)) #define bit(n) (1LL<<(n)) #define popcount(n) (__builtin_popcountll(n)) templatebool chmax(T &a, const T &b) { return (abool chmin(T &a, const T &b) { return (b> t; rep(loop,t){ string s; cin >> s; int n=s.size(); bool ok=true; int white=0,green=0,red=0,bus=0; rep(i,n) if(s[i]=='R') bus++; rep(i,n){ if(bus==0 && s[i]!='R') ok=false; if(s[i]=='W') white++; if(s[i]=='G') green++,bus--; if(s[i]=='R') red++; if(white