#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string r;
    cin >> r;
    int n = r.size();
    r = "#" + r;
    int l = 0, ans = 0;
    for (int i = 1; i <= n; i++) {
      if (r[i] == 'R') {
        ans = max(ans, i - l);
        l = i;
      }
    }
    ans = max(ans, n - l + 1);
    cout << ans << endl;
  }
}
