#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1 << 29;
const long long MAX_N = 1e6 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int n = s.length();
    vector<int> r;
    r.push_back(-1);
    r.push_back(n);
    for (int i = 0; i < n; ++i) {
      if (s[i] == 'R') {
        r.push_back(i);
      }
    }
    sort((r).begin(), (r).end());
    vector<int> r2(r.size());
    for (int j = 1; j < r.size(); ++j) {
      r2[j] = r[j] - r[j - 1];
    }
    sort((r2).begin(), (r2).end());
    int ans = r2[r.size() - 1];
    cout << ans << "\n";
  }
}
