#include <bits/stdc++.h>
using namespace std;
const long long N = 100005;
const long long M = 1000000007;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    vector<long long> v, v1;
    v.push_back(0);
    for (long long i = 0; i < s.length(); i++) {
      if (s[i] == 'R') {
        v.push_back(i + 1);
      }
    }
    v.push_back(s.length() + 1);
    for (long long i = 1; i < v.size(); i++) {
      v1.push_back(v[i] - v[i - 1]);
    }
    sort(v1.begin(), v1.end());
    if (v.size() > 1)
      cout << v1[v1.size() - 1] << endl;
    else {
      cout << s.length() + 1 << endl;
    }
  }
}
