#include "bits/stdc++.h" using namespace std; #define print(x) cout< PI; typedef pair V; typedef vector VE; const ll mod = 1000000007; int main(){ int n; cin>>n; REP(i,n){ string s; cin>>s; int cnt=0; bool flag=1; REP(j,GET_ARRAY_SIZE(s)){ if(s[j]=='G'){cnt++;} else if(s[j]=='R'){cnt--;} if(cnt<0)flag=0; //print(s[j]<<" "<