#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  string s;
  cin >> t;
  while (t--) {
    cin >> s;
    int l = 0, r = s.size() + 1;
    while (r - l > 1) {
      int d = (r + l) / 2;
      bool ans = false;
      int cur = -1;
      for (int i = 0; i <= cur + d; i++) {
        if (s[i] == 'R') {
          if (i + d >= s.size()) {
            ans = true;
            break;
          }
          cur = i;
        }
      }
      if (ans)
        r = d;
      else
        l = d;
    }
    cout << r << '\n';
  }
}
