#include <bits/stdc++.h>
using namespace std;
void solve() {
  string s;
  cin >> s;
  long long ans = 1;
  long long cur = 0;
  for (auto u : s) {
    if (u == 'R') {
      ans = max(ans, cur + 1);
      cur = 0;
    } else
      cur++;
  }
  ans = max(cur + 1, ans);
  cout << ans << "\n";
  return;
}
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
}
