#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int n = s.size();
    s.push_back('R');
    s = "R" + s;
    int l = 0, r = 0;
    int maxJump = 0;
    for (int i = 0; i <= n + 1; i++) {
      if (s[i] == 'R') {
        l = r;
        r = i;
        maxJump = max(maxJump, r - l);
      }
    }
    cout << maxJump << '\n';
  }
}
