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