#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, T, sz, fast, last;
  cin >> T;
  while (T--) {
    string str;
    cin >> str;
    sz = str.size();
    bool at_least_once = false;
    fast = 0;
    last = sz;
    vector<int> diff;
    for (i = sz - 1; i >= 0; i--) {
      if (str[i] == 'R') {
        at_least_once = true;
        fast = i;
        diff.push_back(last - fast);
        last = i;
      }
    }
    if (at_least_once == false) {
      cout << sz + 1 << endl;
      continue;
    } else {
      if (last != 0) diff.push_back(last - 0 + 1);
      int res;
      res = diff.size();
      sort(diff.begin(), diff.end());
      cout << diff[res - 1] << endl;
    }
  }
  return 0;
}
