#include <bits/stdc++.h>
long long m = 1000000007;
long long sieve[1000001] = {0}, i, j;
long long power(long long p, long long k) {
  long long a = 1;
  while (k) {
    if (k & 1) a = (a * p) % m;
    p = (p * p) % m;
    k >>= 1;
  }
  return a;
}
using namespace std;
long long bits(long long n) {
  long long ans = 0;
  while (n) {
    ans += n % 2;
    n >>= 1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long tc = 1;
  cin >> tc;
  while (tc--) {
    string s;
    cin >> s;
    long long ans = s.length() + 2;
    long long sum = 0, pre = 0, n = s.length();
    for (i = 0; i < n; i++) {
      if (s[i] == 'R') {
        sum = max(sum, i + 1 - pre);
        pre = i + 1;
      }
    }
    sum = max(n + 1ll - pre, sum);
    cout << sum;
    cout << "\n";
  }
}
