#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, l, ml;
  string s;
  cin >> t;
  for (int j = 0; j < t; j++) {
    cin >> s;
    ml = 0;
    l = 0;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == 'L') {
        l++;
      }
      if (s[i] == 'R') {
        l = 0;
      }
      if (ml < l) {
        ml = l;
      }
    }
    cout << (ml + 1) << endl;
  }
  return 0;
}
