#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    long long n = s.length();
    vector<long long> v;
    int g = 0;
    v.push_back(0);
    for (long long i = 0; i < n; i++) {
      if (s[i] == 'R') {
        g = 1;
        v.push_back(i + 1);
      }
    }
    v.push_back(n + 1);
    if (g == 0)
      cout << n + 1 << endl;
    else {
      long long max = -1;
      for (long long i = 0; i < v.size() - 1; i++) {
        if (v[i + 1] - v[i] > max) max = v[i + 1] - v[i];
      }
      cout << max << endl;
    }
  }
}
