#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0), cin.sync_with_stdio(0), cout.tie(0), cout.sync_with_stdio(0);
  long long t;
  cin >> t;
  while (t--) {
    long long i, j, k, l, m, n, a = 0, b = 0, c;
    string s;
    cin >> s;
    vector<long long int> v;
    v.push_back(0);
    n = s.size();
    for (i = 0; i < n; i++) {
      if (s[i] == 'R') {
        v.push_back(i + 1);
      }
    }
    v.push_back(n + 1);
    for (i = 0; i < v.size() - 1; i++) a = max(a, (abs(v[i] - v[i + 1])));
    cout << a << "\n";
  }
}
