#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  long long t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    long long n = s.size();
    long long id = 0, diff;
    long long mx_diff = 0;
    for (long long i = 0; i < n; i++) {
      if (s[i] == 'R') {
        diff = (i + 1) - id;
        id = i + 1;
        if (diff > mx_diff) {
          mx_diff = diff;
        }
      }
    }
    diff = (n + 1) - id;
    if (diff > mx_diff) {
      mx_diff = diff;
    }
    if (mx_diff == 0) {
      cout << (n + 1) << endl;
    } else {
      cout << mx_diff << endl;
    }
  }
  return 0;
}
