#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  long long tc;
  cin >> tc;
  while (tc--) {
    string str;
    cin >> str;
    long long n = str.size();
    long long ans = 0, k = 0;
    for (long long i = 1; i <= n; i++) {
      if (str[i - 1] == 'R') {
        ans = max(ans, i - k);
        k = i;
      }
    }
    ans = max(ans, n + 1 - k);
    cout << ans << "\n";
  }
}
