#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  long long t, n;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int saiz = s.size();
    int maxx = 0;
    int lasti;
    bool flag = 0, b = 0;
    for (int i = 0; i < saiz; ++i) {
      if (s[i] == 'R') {
        b = 1;
        if (flag) {
          if ((i - lasti) > maxx) maxx = i - lasti;
        } else {
          maxx = i + 1;
          flag = 1;
        }
        lasti = i;
      }
    }
    if ((saiz - lasti) > maxx) maxx = saiz - lasti;
    if (b)
      cout << maxx << '\n';
    else
      cout << saiz + 1 << '\n';
  }
  return 0;
}
