#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
const long long nmax = 1e16 + 3;
const long long mod = 998244353;
const int inf = 2e9 + 3;
using namespace std;
int main() {
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cerr.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int cur = 0;
    int ans = 0;
    for (int i = 0; i < s.size(); i++)
      if (s[i] == 'R') {
        ans = max(ans, i + 1 - cur);
        cur = i + 1;
      }
    int n = s.size();
    ans = max(ans, n - cur + 1);
    cout << ans << "\n";
  }
}
