#include <bits/stdc++.h>
using namespace std;
struct hash_pair {
  template <class T1, class T2>
  size_t operator()(const pair<T1, T2>& p) const {
    auto hash1 = hash<T1>{}(p.first);
    auto hash2 = hash<T2>{}(p.second);
    return hash1 ^ hash2;
  }
};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long tc;
  cin >> tc;
  while (tc--) {
    string s;
    cin >> s;
    long long mx = -1;
    long long prev = 0;
    long long fst = -1;
    for (long long i = 0; i < s.length(); i++) {
      if (s[i] == 'R') {
        if (fst < 0) fst = i;
        if (i - prev > mx) mx = i - prev;
        prev = i;
      }
    }
    if (fst >= 0)
      cout << (mx > s.length() - prev
                   ? (mx > fst + 1 ? mx : fst + 1)
                   : (s.length() - prev > fst + 1 ? s.length() - prev
                                                  : fst + 1))
           << "\n";
    else {
      cout << s.length() + 1 << "\n";
    }
  }
}
