#include <bits/stdc++.h>
using namespace std;
int a[200005];
int main() {
  int test;
  scanf("%d", &(test));
  for (int t = 1; t <= test; t++) {
    int cnt = 0;
    a[cnt++] = -1;
    string s;
    cin >> s;
    int n = s.size();
    for (int i = 0; i < n; i++) {
      if (s[i] == 'R') a[cnt++] = i;
    }
    a[cnt++] = n;
    int mx = 0;
    for (int i = 1; i < cnt; i++) {
      mx = max(mx, a[i] - a[i - 1]);
    }
    cout << mx << endl;
  }
  return 0;
}
