#include <bits/stdc++.h>
using namespace std;
void solve() {
  string str;
  string s = "R";
  cin >> str;
  s += str;
  s += "R";
  long long ans = 0;
  long long n = str.length() + 2;
  long long temp;
  for (long long i = 0; i < n; i++) {
    if (s[i] == 'R') {
      ans = max(ans, i - temp);
      temp = i;
    }
  }
  cout << ans << "\n";
  return;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
