#include <bits/stdc++.h>
using namespace std;
set<int> ist;
map<string, int> msi;
map<string, string> mss;
map<int, string> mis;
map<int, int> mii;
vector<int> v;
vector<pair<int, int> > vv;
int cc[] = {1, -1, 0, 0};
int rr[] = {0, 0, 1, -1};
int n;
void LIFT_OFF_FALCON_M2M_96_8() {
  int t;
  cin >> t;
  while (t--) {
    int ans = 0, flag = 0, cnt = 0;
    string sp;
    cin >> sp;
    int ml = 0;
    int l = sp.size();
    for (int i = 0; i < l; i++) {
      if (sp[i] == 'L') {
        flag = 1;
        cnt = 0;
        while (sp[i] == 'L') {
          i++;
          cnt++;
        }
      }
      ans = max(ans, cnt);
    }
    if (!flag) {
      cout << 1 << endl;
    } else {
      cout << ans + 1 << endl;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  LIFT_OFF_FALCON_M2M_96_8();
  return 0;
}
