#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    string input;
    cin >> input;
    vector<long long> arr;
    arr.push_back(0);
    long long n = input.size();
    for (long long i = 0; i < n; i++) {
      if (input[i] == 'R') arr.push_back(i + 1);
    }
    arr.push_back(n + 1);
    long long ans = 0;
    for (long long i = 0; i < arr.size() - 1; i++)
      ans = max(ans, arr[i + 1] - arr[i]);
    cout << ans << endl;
  }
}
