#include <bits/stdc++.h>
using namespace std;
long long i, j, k, n, m, res, c1, c0;
long long a[200009];
string s;
set<long long> st;
queue<long long> q;
int main() {
  int nt;
  cin >> nt;
  while (nt--) {
    cin >> s;
    s = 'R' + s;
    s += 'R';
    long long last = 0, res = 0;
    for (i = 0; i < s.length(); i++) {
      if (s[i] == 'R') res = max(res, i - last), last = i;
    }
    cout << res << '\n';
  }
  exit(0);
}
