#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  std::vector<int> out(t);
  for (int i = 0; i < t; i++) {
    string s;
    cin >> s;
    s = "R" + s + "R";
    int prev = -1;
    int maxjmp = 1;
    for (int j = 0; j < s.length(); j++) {
      if (s[j] == 'R') {
        if (prev == -1)
          prev = j;
        else {
          maxjmp = max(maxjmp, j - prev);
          prev = j;
        }
      }
    }
    out[i] = maxjmp;
  }
  for (int i = 0; i < t; i++) {
    cout << out[i] << endl;
  }
}
