#include <bits/stdc++.h>
using namespace std;
long long i, j, k, l, n, m, d;
string s;
int main() {
  cin >> n;
  for (j = 1; j <= n; j++) {
    s.clear();
    cin >> s;
    k = 0;
    s = 'R' + s + 'R';
    l = 0;
    for (i = 1; i < s.size(); i++) {
      if (s[i] == 'R') {
        m = i - l;
        l = i;
        k = max(k, m);
      }
    }
    cout << k << endl;
  }
}
