#include <bits/stdc++.h>
using namespace std;
int main() {
  int tc;
  cin >> tc;
  while (tc--) {
    string s;
    cin >> s;
    vector<int> v;
    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);
    int c = 0;
    for (int i = 0; i < v.size() - 1; i++) {
      c = max(c, v[i + 1] - v[i]);
    }
    cout << c << endl;
  }
  return 0;
}
