#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
int main() {
  int tc;
  cin >> tc;
  while (tc--) {
    int ans = -1;
    string str;
    cin >> str;
    vi pos;
    pos.push_back(0);
    for (int i = 0; i < str.size(); i++) {
      if (str[i] == 'R') {
        pos.push_back(i + 1);
      }
    }
    pos.push_back(str.size() + 1);
    for (int i = 0; i < pos.size() - 1; i++) {
      ans = max(ans, pos[i + 1] - pos[i]);
    }
    cout << ans << endl;
  }
  return 0;
}
