#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    s += 'R';
    vector<long long> v;
    v.push_back(0);
    for (long long i = 0; i < s.size(); i++) {
      if (s[i] == 'R') {
        v.push_back(i + 1);
      }
    }
    long long f = 0;
    for (long long i = 0; i < v.size() - 1; i++) {
      f = max(f, v[i + 1] - v[i]);
    }
    cout << f << endl;
  }
  return 0;
}
