#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    std::vector<int> a;
    int i, x, n, flag = 0, k = 0;
    string s;
    cin >> s;
    n = s.length();
    a.push_back(0);
    for (i = 0; i < n; i++) {
      if (s[i] == 'R') a.push_back(i + 1);
    }
    a.push_back(n + 1);
    for (i = 1; i < a.size(); i++) {
      k = a[i] - a[i - 1];
      if (k > flag) flag = k;
    }
    cout << flag << endl;
  }
  return 0;
}
