/*#pragma GCC optimize("Ofast") #pragma GCC optimize("avx2") #pragma GCC optimize("unroll-loops")*/ #define ll int64_t #include using namespace std; const ll MAXN=1e5+1; ll n,brl[MAXN],brt[MAXN],brr[MAXN]; string s; void solve(){ cin>>s; n=s.size(); s="$"+s+"$"; for(ll i=1;i<=n;i++){ brl[i]=brl[i-1]; if(s[i]=='R') brl[i]++; } for(ll i=1;i<=n;i++){ if(s[i]=='L') brl[i]+=brl[i-1]; else brl[i]=brl[i-1]; } for(ll i=1;i<=n;i++){ brt[i]=brt[i-1]; if(s[i]=='L') brt[i]++; } for(ll i=1;i<=n;i++){ brr[i]=brr[i-1]; if(s[i]=='R') brr[i]++; } ll q,l,r; cin>>q; while(q--){ cin>>l>>r; cout<>t; while(t--) solve(); return 0; }