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