#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n;
  cin >> t;
  string s;
  int x = 0;
  vector<int> v;
  bool flag;
  while (t--) {
    x = 0;
    v.clear();
    cin >> s;
    v.push_back(0);
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == 'R') {
        v.push_back(i + 1);
      }
    }
    v.push_back(s.size() + 1);
    for (int i = 1; i < v.size(); i++) {
      x = max((v[i] - v[i - 1]), x);
    }
    cout << x << "\n";
  }
  return 0;
}
