#include <bits/stdc++.h>
using namespace std;
int main() {
  int tt;
  cin >> tt;
  while (tt--) {
    string s;
    cin >> s;
    s = 'R' + s;
    int n = s.length();
    int rind = -1;
    int ans = 0;
    for (int i = n - 1; i >= 0; i--) {
      if (s[i] == 'R') {
        rind = i;
        break;
      }
    }
    int diff = n - rind;
    int i = rind;
    int temp = rind;
    while (i >= 0) {
      if (s[i] == 'R') {
        temp = i;
        if (rind - temp > diff) diff = rind - temp;
        rind = temp;
      }
      i--;
    }
    cout << diff << endl;
  }
  return 0;
}
