#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const int INF = 0x3f3f3f3f;
const int SZ = 2e5 + 10;
int n;
char s[SZ];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%s", s + 1);
    int len = strlen(s + 1);
    s[0] = 'R';
    s[len + 1] = 'R';
    int pre = 0;
    int ans = 0;
    for (int i = 1; i <= len + 1; i++) {
      if (s[i] == 'R') {
        ans = max(ans, i - pre);
        pre = i;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
