#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long gcdll(long long a, long long b) {
  if (!b) return a;
  return gcdll(b, a % b);
}
void seive(int n) {
  vector<bool> is_prime(n + 1, true);
  is_prime[0] = is_prime[1] = false;
  for (int i = 2; i * i <= n; i++) {
    if (is_prime[i]) {
      for (int j = i * i; j <= n; j += i) {
        is_prime[j] = false;
      }
    }
  }
}
vector<int> constructZFunc(string s) {
  int n = s.size();
  vector<int> z(n);
  int l, r;
  l = r = 0;
  z[0] = 0;
  for (int i = 1; i <= n - 1; i++) {
    z[i] = 0;
    if (i <= r) {
      z[i] = min(r - i + 1, z[i - l]);
    }
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];
    if (i + z[i] - 1 > r) {
      r = i + z[i] - 1;
      l = i;
    }
  }
  return z;
}
int solve() {
  string s;
  cin >> s;
  int n = s.size();
  vector<int> v;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'R') v.push_back(i + 1);
  }
  v.push_back(n + 1);
  int st = 0;
  int ans = v[0] - st;
  for (int i = 1; i <= v.size() - 1; i++) {
    ans = max(ans, v[i] - v[i - 1]);
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  cin >> t;
  while (t--) {
    cout << solve() << endl;
  }
  return 0;
}
