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