#include <bits/stdc++.h>
using namespace std;
int main() {
  int t = 0;
  cin >> t;
  while (t--) {
    int dist = 0, ans = 0;
    int i = 1, last = 0;
    string s;
    cin >> s;
    int n = s.size();
    while (i <= s.size()) {
      if (s[i - 1] == 'R') {
        ans = max(ans, i - last);
        last = i;
      }
      i++;
    }
    ans = max(ans, n + 1 - last);
    cout << ans << "\n";
  }
  return 0;
}
