#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  for (int i = 0; i < n; ++i) {
    cin >> s;
    s = 'R' + s + 'R';
    int ans = 0;
    int prev = 0;
    for (int j = 1; j < s.size(); ++j) {
      if (s[j] == 'R') {
        if (j - prev > ans) {
          ans = j - prev;
        }
        prev = j;
      }
    }
    cout << ans << '\n';
  }
  return 0;
}
