#include <bits/stdc++.h>
using namespace std;
namespace IO {
inline bool read() { return true; }
template <class T1, class... T2>
bool read(T1 &a, T2 &...rest) {
  return (cin >> a) ? read(rest...) : 0;
}
template <class... T>
bool read(char *a, T &...rest) {
  return (cin >> a) ? read(rest...) : 0;
}
template <class... T>
bool read(char *a, char *b, T &...rest) {
  return (cin >> a >> b) ? read(rest...) : 0;
}
template <class... T>
bool read(char *a, char *b, char *c, T &...rest) {
  return (cin >> a >> b >> c) ? read(rest...) : 0;
}
void put() { cout << '\n'; }
template <class T1, class... T2>
void put(const T1 num, const T2... rest) {
  cout << num << ' ';
  put(rest...);
}
void puta() {}
template <class T1, class... T2>
void puta(const T1 num, const T2... rest) {
  cout << num << ' ';
  puta(rest...);
}
void yes() { put("YES"); }
void no() { put("NO"); }
void ff() { cout.flush(); }
}  // namespace IO
using namespace IO;
using db = double;
using vi = vector<int>;
using pii = pair<int, int>;
using ll = long long;
using cp = complex<double>;
const int mod = 998244353, inv2 = (mod + 1) / 2;
const int maxn = 2e5 + 10;
const int inf = 1e9 + 3;
void prepare() {}
char s[maxn];
void Solve(int cas = 1) {
  read(s + 1);
  int n = strlen(s + 1);
  s[0] = s[n + 1] = 'R';
  int mx = 0;
  int k = 0;
  for (int i = 1; i <= n + 1; i++) {
    if (s[i] == 'R') {
      int p = i - k;
      ((mx) = max((mx), (p)));
      k = i;
    }
  }
  put(mx);
}
void Solvem() {
  int T;
  read(T);
  for (int i = 1; i <= T; i++) Solve(i);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  prepare();
  Solvem();
  return 0;
}
