#include <bits/stdc++.h>
using namespace std;
char s[200010];
int main() {
  int t, n, i, mx, pre;
  scanf("%d", &t);
  while (t--) {
    scanf("%s", s + 1);
    n = strlen(s + 1), mx = -1;
    s[0] = 'R', n++, s[n] = 'R', pre = 0;
    for (i = 0; i <= n; i++)
      if (s[i] == 'R') {
        mx = max(mx, i - pre);
        pre = i;
      }
    printf("%d\n", mx);
  }
  return 0;
}
