#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  int t;
  cin >> t;
  while (t--) {
    string line;
    cin >> line;
    int n = line.size();
    int ret = 0;
    int last = -1;
    for (int i = 0; i < n; i++) {
      if (line[i] == 'R') {
        ret = max(ret, i - last);
        last = i;
      }
    }
    ret = max(ret, n - last);
    cout << ret << endl;
  }
}
