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