#include <bits/stdc++.h>
using namespace std;
bool visited[100005 + 1];
vector<long long int> adj[100005 + 1];
long long int level[100005 + 1];
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    std::map<long long int, long long int> m;
    string s;
    cin >> s;
    std::vector<long long int> v;
    long long int n = s.size();
    for (long long int i = 0; i < s.size(); i++) {
      if (s[i] == 'R') {
        m[1]++;
        v.push_back(i + 1);
      } else {
        m[0]++;
      }
    }
    if (m[0] == s.size()) {
      cout << s.size() + 1 << endl;
      continue;
    } else if (m[1] == s.size()) {
      cout << 1 << endl;
      continue;
    }
    if (v.size() == 1) {
      cout << max(v[0], n + 1 - v[0]) << endl;
      continue;
    }
    long long int l = v.size();
    long long int val = max(v[0], n + 1 - v[l - 1]);
    long long int temp = INT_MIN;
    for (long long int i = 0; i < l - 1; i++) {
      temp = max(temp, v[i + 1] - v[i]);
    }
    cout << max(temp, val) << endl;
  }
}
