#include <bits/stdc++.h>
using namespace std;
void solve() {
  string s;
  cin >> s;
  int n = s.length();
  vector<int> ind;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'R') {
      ind.push_back(i);
    }
  }
  if (ind.size() == 0) {
    cout << n + 1 << endl;
  } else if (ind.size() == 1) {
    cout << max(n - ind[0], ind[0] + 1) << endl;
  } else {
    int SIZE = ind.size();
    int maxm = INT_MIN;
    for (int i = 1; i < SIZE; i++) {
      maxm = max(maxm, ind[i] - ind[i - 1]);
    }
    cout << max(maxm, max(n - ind[SIZE - 1], ind[0] + 1)) << endl;
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
