#include <bits/stdc++.h>
using namespace std;
int canReach(string jumps) {
  vector<int> reachable(jumps.size(), 0);
  int mxm = 1, counter = 1;
  for (int i = jumps.size() - 1; i >= 0; i--) {
    counter++;
    if (jumps[i] == 'R') {
      if (i + mxm >= jumps.size()) {
        reachable[i] = counter;
        counter = 1;
      } else if (counter > 0) {
        reachable[i] = counter;
        counter = 1;
      }
    }
    mxm = max(mxm, counter);
  }
  return mxm;
}
int main() {
  int temp;
  cin >> temp;
  while (temp--) {
    string jumps = "R";
    string input;
    cin >> input;
    jumps += input;
    cout << canReach(jumps) << endl;
  }
  return 0;
}
